diff options
| author | Glenn Morris | 2012-12-06 20:37:14 -0800 |
|---|---|---|
| committer | Glenn Morris | 2012-12-06 20:37:14 -0800 |
| commit | 13a40633cfb5d3b97f26b362c27ffb50846dc1bb (patch) | |
| tree | 28f32756da75f92ca1ee0b80057c1f5781a69502 | |
| parent | 4611a3cce757d835a812820e2a65bdc56441463a (diff) | |
| download | emacs-13a40633cfb5d3b97f26b362c27ffb50846dc1bb.tar.gz emacs-13a40633cfb5d3b97f26b362c27ffb50846dc1bb.zip | |
Default to mboxrd in Rmail, allow mboxo as an option
* lisp/mail/unrmail.el (unrmail-mbox-format): New option.
(batch-unrmail, unrmail): Doc fixes.
(unrmail): Respect unrmail-mbox-format.
* lisp/mail/rmail.el (rmail-mbox-format): New option.
(rmail-show-message-1): Respect rmail-mbox-format.
* etc/NEWS: Related edits.
Fixes: debbugs:6574
| -rw-r--r-- | etc/NEWS | 8 | ||||
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/mail/rmail.el | 36 | ||||
| -rw-r--r-- | lisp/mail/unrmail.el | 41 |
4 files changed, 77 insertions, 16 deletions
| @@ -58,6 +58,14 @@ amounts of data into the ERC input. | |||
| 58 | ** MH-E has been updated to MH-E version 8.4. | 58 | ** MH-E has been updated to MH-E version 8.4. |
| 59 | See MH-E-NEWS for details. | 59 | See MH-E-NEWS for details. |
| 60 | 60 | ||
| 61 | --- | ||
| 62 | ** The unrmail command converts from BABYL to mboxrd rather than mboxo. | ||
| 63 | Customize `unrmail-mbox-format' to change this. | ||
| 64 | |||
| 65 | --- | ||
| 66 | ** Similarly, customize `rmail-mbox-format' to influence some minor aspects | ||
| 67 | of how Rmail displays non-MIME messages. | ||
| 68 | |||
| 61 | +++ | 69 | +++ |
| 62 | ** New function `ses-rename-cell' to give SES cells arbitrary names. | 70 | ** New function `ses-rename-cell' to give SES cells arbitrary names. |
| 63 | 71 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 51d2ec6cbd1..940dc62fedf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2012-12-07 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * mail/unrmail.el (unrmail-mbox-format): New option. (Bug#6574) | ||
| 4 | (batch-unrmail, unrmail): Doc fixes. | ||
| 5 | (unrmail): Respect unrmail-mbox-format. | ||
| 6 | * mail/rmail.el (rmail-mbox-format): New option. | ||
| 7 | (rmail-show-message-1): Respect rmail-mbox-format. | ||
| 8 | |||
| 1 | 2012-12-07 Stefan Monnier <monnier@iro.umontreal.ca> | 9 | 2012-12-07 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 10 | ||
| 3 | * emacs-lisp/cl-macs.el (cl-tagbody): New macro. | 11 | * emacs-lisp/cl-macs.el (cl-tagbody): New macro. |
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 372b120046c..b16f501a999 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -2699,6 +2699,27 @@ N defaults to the current message." | |||
| 2699 | :group 'rmail | 2699 | :group 'rmail |
| 2700 | :version "23.1") | 2700 | :version "23.1") |
| 2701 | 2701 | ||
| 2702 | ;; FIXME? | ||
| 2703 | ;; rmail-show-mime-function does not unquote >From lines. Should it? | ||
| 2704 | (defcustom rmail-mbox-format 'mboxrd | ||
| 2705 | "The mbox format that your system uses. | ||
| 2706 | There is no way to determine this, so you should set the appropriate value. | ||
| 2707 | The formats quote lines containing \"From \" differently. | ||
| 2708 | The choices are: | ||
| 2709 | `mboxo' : lines that start with \"From \" quoted as \">From \" | ||
| 2710 | `mboxrd': lines that start with \">*From \" quoted with another \">\" | ||
| 2711 | The `mboxo' format is ambiguous, in that one cannot know whether | ||
| 2712 | a line starting with \">From \" originally had a \">\" or not. | ||
| 2713 | |||
| 2714 | It is not critical to set this to the correct value; it only affects | ||
| 2715 | how Rmail displays lines starting with \">*From \" in non-MIME messages. | ||
| 2716 | |||
| 2717 | See also `unrmail-mbox-format'." | ||
| 2718 | :type '(choice (const 'mboxrd) | ||
| 2719 | (const 'mboxro)) | ||
| 2720 | :version "24.4" | ||
| 2721 | :group 'rmail) | ||
| 2722 | |||
| 2702 | (defun rmail-show-message-1 (&optional msg) | 2723 | (defun rmail-show-message-1 (&optional msg) |
| 2703 | "Show message MSG (default: current message) using `rmail-view-buffer'. | 2724 | "Show message MSG (default: current message) using `rmail-view-buffer'. |
| 2704 | Return text to display in the minibuffer if MSG is out of | 2725 | Return text to display in the minibuffer if MSG is out of |
| @@ -2791,11 +2812,15 @@ The current mail message becomes the message displayed." | |||
| 2791 | ;; Prepare the separator (blank line) before the body. | 2812 | ;; Prepare the separator (blank line) before the body. |
| 2792 | (goto-char (point-min)) | 2813 | (goto-char (point-min)) |
| 2793 | (insert "\n") | 2814 | (insert "\n") |
| 2794 | ;; Unquote quoted From lines | 2815 | ;; Unquote quoted From lines. |
| 2795 | (while (re-search-forward "^>+From " nil t) | 2816 | (let ((fromline (if (eq 'mboxrd rmail-mbox-format) |
| 2796 | (beginning-of-line) | 2817 | "^>+From " |
| 2797 | (delete-char 1) | 2818 | "^>From ")) |
| 2798 | (forward-line)) | 2819 | case-fold-search) |
| 2820 | (while (re-search-forward fromline nil t) | ||
| 2821 | (beginning-of-line) | ||
| 2822 | (delete-char 1) | ||
| 2823 | (forward-line))) | ||
| 2799 | (goto-char (point-min))) | 2824 | (goto-char (point-min))) |
| 2800 | ;; Copy the headers to the front of the message view buffer. | 2825 | ;; Copy the headers to the front of the message view buffer. |
| 2801 | (rmail-copy-headers beg end) | 2826 | (rmail-copy-headers beg end) |
| @@ -3869,6 +3894,7 @@ see the documentation of `rmail-resend'." | |||
| 3869 | (msgnum rmail-current-message) | 3894 | (msgnum rmail-current-message) |
| 3870 | (subject (concat "[" | 3895 | (subject (concat "[" |
| 3871 | (let ((from (or (mail-fetch-field "From") | 3896 | (let ((from (or (mail-fetch-field "From") |
| 3897 | ;; FIXME - huh? | ||
| 3872 | (mail-fetch-field ">From")))) | 3898 | (mail-fetch-field ">From")))) |
| 3873 | (if from | 3899 | (if from |
| 3874 | (concat (mail-strip-quoted-names from) ": ") | 3900 | (concat (mail-strip-quoted-names from) ": ") |
diff --git a/lisp/mail/unrmail.el b/lisp/mail/unrmail.el index bf7b9abe2c1..23675d90713 100644 --- a/lisp/mail/unrmail.el +++ b/lisp/mail/unrmail.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; unrmail.el --- convert Rmail Babyl files to mailbox files | 1 | ;;; unrmail.el --- convert Rmail Babyl files to mbox files |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1992, 2001-2012 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1992, 2001-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Maintainer: FSF | 5 | ;; Maintainer: FSF |
| 6 | ;; Keywords: mail | 6 | ;; Keywords: mail |
| @@ -26,7 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | ;;;###autoload | 27 | ;;;###autoload |
| 28 | (defun batch-unrmail () | 28 | (defun batch-unrmail () |
| 29 | "Convert old-style Rmail Babyl files to system inbox format. | 29 | "Convert old-style Rmail Babyl files to mbox format. |
| 30 | Specify the input Rmail Babyl file names as command line arguments. | 30 | Specify the input Rmail Babyl file names as command line arguments. |
| 31 | For each Rmail file, the corresponding output file name | 31 | For each Rmail file, the corresponding output file name |
| 32 | is made by adding `.mail' at the end. | 32 | is made by adding `.mail' at the end. |
| @@ -45,9 +45,26 @@ For example, invoke `emacs -batch -f batch-unrmail RMAIL'." | |||
| 45 | (declare-function mail-mbox-from "mail-utils" ()) | 45 | (declare-function mail-mbox-from "mail-utils" ()) |
| 46 | (defvar rmime-magic-string) ; in rmime.el, if you have it | 46 | (defvar rmime-magic-string) ; in rmime.el, if you have it |
| 47 | 47 | ||
| 48 | (defcustom unrmail-mbox-format 'mboxrd | ||
| 49 | "The mbox format that `unrmail' should produce. | ||
| 50 | These formats separate messages using lines that start with \"From \". | ||
| 51 | Therefore any lines in the message bodies that start with \"From \" | ||
| 52 | must be quoted. The `mboxo' format just prepends a \">\" to such lines. | ||
| 53 | This is not reversible, because given a line starting with \">From \" in | ||
| 54 | an mboxo file, it is not possible to know whether the original had a \">\" | ||
| 55 | or not. The `mxbord' format avoids this by also quoting \">From \" as | ||
| 56 | \">>From \", and so on. For this reason, mboxrd is recommended. | ||
| 57 | |||
| 58 | See also `rmail-mbox-format'." | ||
| 59 | :type '(choice (const 'mboxrd) | ||
| 60 | (const 'mboxro)) | ||
| 61 | :version "24.4" | ||
| 62 | :group 'rmail) | ||
| 63 | |||
| 48 | ;;;###autoload | 64 | ;;;###autoload |
| 49 | (defun unrmail (file to-file) | 65 | (defun unrmail (file to-file) |
| 50 | "Convert old-style Rmail Babyl file FILE to system inbox format file TO-FILE." | 66 | "Convert old-style Rmail Babyl file FILE to mbox format file TO-FILE. |
| 67 | The variable `unrmail-mbox-format' controls which mbox format to use." | ||
| 51 | (interactive "fUnrmail (babyl file): \nFUnrmail into (new mailbox file): ") | 68 | (interactive "fUnrmail (babyl file): \nFUnrmail into (new mailbox file): ") |
| 52 | (with-temp-buffer | 69 | (with-temp-buffer |
| 53 | ;; Read in the old Rmail file with no decoding. | 70 | ;; Read in the old Rmail file with no decoding. |
| @@ -224,13 +241,15 @@ For example, invoke `emacs -batch -f batch-unrmail RMAIL'." | |||
| 224 | (when keywords | 241 | (when keywords |
| 225 | (insert "X-RMAIL-KEYWORDS: " keywords "\n")) | 242 | (insert "X-RMAIL-KEYWORDS: " keywords "\n")) |
| 226 | (goto-char (point-min)) | 243 | (goto-char (point-min)) |
| 227 | ;; ``Quote'' "\nFrom " as "\n>From " | 244 | ;; Convert From to >From, etc. |
| 228 | ;; (note that this isn't really quoting, as there is no requirement | 245 | (let ((case-fold-search nil) |
| 229 | ;; that "\n[>]+From " be quoted in the same transparent way.) | 246 | (fromline (if (eq 'mboxrd unrmail-mbox-format) |
| 230 | (let ((case-fold-search nil)) | 247 | "^>*From " |
| 231 | (while (search-forward "\nFrom " nil t) | 248 | "^From "))) |
| 232 | (forward-char -5) | 249 | (while (re-search-forward fromline nil t) |
| 233 | (insert ?>))) | 250 | (beginning-of-line) |
| 251 | (insert ?>) | ||
| 252 | (forward-line 1))) | ||
| 234 | (goto-char (point-max)) | 253 | (goto-char (point-max)) |
| 235 | ;; Add terminator blank line to message. | 254 | ;; Add terminator blank line to message. |
| 236 | (insert "\n") | 255 | (insert "\n") |