comparison lisp/mail/unrmail.el @ 101536:a8fcffcd20d5

(command-line-args-left): Remove unneeded declaration. (batch-unrmail, unrmail): Doc fix.
author Glenn Morris <rgm@gnu.org>
date Tue, 27 Jan 2009 03:41:25 +0000
parents a9dc0e7c3f2b
children 01abffb7f38c
comparison
equal deleted inserted replaced
101535:8b115b281787 101536:a8fcffcd20d5
1 ;;; unrmail.el --- convert Rmail files to mailbox files 1 ;;; unrmail.el --- convert Rmail Babyl files to mailbox files
2 2
3 ;; Copyright (C) 1992, 2001, 2002, 2003, 2004, 2005, 3 ;; Copyright (C) 1992, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 ;; 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 4 ;; 2009 Free Software Foundation, Inc.
5 5
6 ;; Maintainer: FSF 6 ;; Maintainer: FSF
7 ;; Keywords: mail 7 ;; Keywords: mail
8 8
9 ;; This file is part of GNU Emacs. 9 ;; This file is part of GNU Emacs.
23 23
24 ;;; Commentary: 24 ;;; Commentary:
25 25
26 ;;; Code: 26 ;;; Code:
27 27
28 (defvar command-line-args-left) ;Avoid 'free variable' warning
29
30 ;;;###autoload 28 ;;;###autoload
31 (defun batch-unrmail () 29 (defun batch-unrmail ()
32 "Convert Rmail files to system inbox format. 30 "Convert old-style Rmail Babyl files to system inbox format.
33 Specify the input Rmail file names as command line arguments. 31 Specify the input Rmail Babyl file names as command line arguments.
34 For each Rmail file, the corresponding output file name 32 For each Rmail file, the corresponding output file name
35 is made by adding `.mail' at the end. 33 is made by adding `.mail' at the end.
36 For example, invoke `emacs -batch -f batch-unrmail RMAIL'." 34 For example, invoke `emacs -batch -f batch-unrmail RMAIL'."
37 ;; command-line-args-left is what is left of the command line (from startup.el)
38 (if (not noninteractive) 35 (if (not noninteractive)
39 (error "`batch-unrmail' is to be used only with -batch")) 36 (error "`batch-unrmail' is to be used only with -batch"))
40 (let ((error nil)) 37 (let ((error nil))
41 (while command-line-args-left 38 (while command-line-args-left
42 (or (unrmail (car command-line-args-left) 39 (or (unrmail (car command-line-args-left)
48 45
49 (declare-function mail-strip-quoted-names "mail-utils" (address)) 46 (declare-function mail-strip-quoted-names "mail-utils" (address))
50 47
51 ;;;###autoload 48 ;;;###autoload
52 (defun unrmail (file to-file) 49 (defun unrmail (file to-file)
53 "Convert Rmail file FILE to system inbox format file TO-FILE." 50 "Convert old-style Rmail Babyl file FILE to system inbox format file TO-FILE."
54 (interactive "fUnrmail (rmail file): \nFUnrmail into (new mailbox file): ") 51 (interactive "fUnrmail (babyl file): \nFUnrmail into (new mailbox file): ")
55 (with-temp-buffer 52 (with-temp-buffer
56 ;; Read in the old Rmail file with no decoding. 53 ;; Read in the old Rmail file with no decoding.
57 (let ((coding-system-for-read 'raw-text)) 54 (let ((coding-system-for-read 'raw-text))
58 (insert-file-contents file)) 55 (insert-file-contents file))
59 ;; But make it multibyte. 56 ;; But make it multibyte.
175 (delete-region (point-min) (point))) 172 (delete-region (point-min) (point)))
176 173
177 ;; Some operations on the message header itself. 174 ;; Some operations on the message header itself.
178 (goto-char (point-min)) 175 (goto-char (point-min))
179 (save-restriction 176 (save-restriction
180 (narrow-to-region 177 (narrow-to-region
181 (point-min) 178 (point-min)
182 (save-excursion (search-forward "\n\n" nil 'move) (point))) 179 (save-excursion (search-forward "\n\n" nil 'move) (point)))
183 180
184 ;; Fetch or construct what we should use in the `From ' line. 181 ;; Fetch or construct what we should use in the `From ' line.
185 (setq mail-from 182 (setq mail-from
223 (kill-buffer temp-buffer)) 220 (kill-buffer temp-buffer))
224 (message "Writing messages to %s...done" to-file))) 221 (message "Writing messages to %s...done" to-file)))
225 222
226 (provide 'unrmail) 223 (provide 'unrmail)
227 224
225 ;; arch-tag: 14c6290d-60b2-456f-8909-5c2387de6acb
228 ;;; unrmail.el ends here 226 ;;; unrmail.el ends here
229
230 ;; arch-tag: 14c6290d-60b2-456f-8909-5c2387de6acb