Mercurial > emacs
comparison lisp/mail/unrmail.el @ 982:595f9517f205
entered into RCS
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 14 Aug 1992 00:14:17 +0000 |
parents | |
children | fb0ed5a1d0f3 |
comparison
equal
deleted
inserted
replaced
981:49a539ef702f | 982:595f9517f205 |
---|---|
1 ;;; unrmail.el --- convert Rmail files to mailbox files. | |
2 ;;; Copyright (C) 1992 Free Software Foundation, Inc. | |
3 | |
4 ;; This file is part of GNU Emacs. | |
5 | |
6 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
7 ;; it under the terms of the GNU General Public License as published by | |
8 ;; the Free Software Foundation; either version 2, or (at your option) | |
9 ;; any later version. | |
10 | |
11 ;; GNU Emacs is distributed in the hope that it will be useful, | |
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 ;; GNU General Public License for more details. | |
15 | |
16 ;; You should have received a copy of the GNU General Public License | |
17 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
18 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
19 | |
20 (defvar command-line-args-left) ;Avoid 'free variable' warning | |
21 | |
22 ;;;###autoload | |
23 (defun batch-unrmail () | |
24 "Convert Rmail files to mailbox files. | |
25 Specify the input Rmail file names as command line arguments. | |
26 For each Rmail file, the corresponding output file name | |
27 is made by adding `.mail' at the end. | |
28 For example, invoke `emacs -batch -f batch-unrmail RMAIL'." | |
29 ;; command-line-args-left is what is left of the command line (from startup.el) | |
30 (if (not noninteractive) | |
31 (error "`batch-unrmail' is to be used only with -batch")) | |
32 (let ((error nil)) | |
33 (while command-line-args-left | |
34 (or (unrmail (car command-line-args-left) | |
35 (concat (car command-line-args-left) ".mail")) | |
36 (setq error t)) | |
37 (setq command-line-args-left (cdr command-line-args-left))) | |
38 (message "Done") | |
39 (kill-emacs (if error 1 0)))) | |
40 | |
41 ;;;###autoload | |
42 (defun unrmail (file to-file) | |
43 "Convert Rmail file FILE to mailbox-format file TO-FILE." | |
44 (interactive "fUnrmail (rmail file): \nfUnrmail into (new mailbox file): ") | |
45 (let ((message-count 0)) | |
46 (rmail file) | |
47 (rmail-show-message 1) | |
48 (while (not (rmail-output to-file)) | |
49 (setq message-count (1+ message-count))))) |