emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111140: Default to mboxrd in Rmail,


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111140: Default to mboxrd in Rmail, allow mboxo as an option
Date: Thu, 06 Dec 2012 20:37:14 -0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111140
fixes bug: http://debbugs.gnu.org/6574
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Thu 2012-12-06 20:37:14 -0800
message:
  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.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/mail/rmail.el
  lisp/mail/unrmail.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2012-12-07 03:56:57 +0000
+++ b/etc/NEWS  2012-12-07 04:37:14 +0000
@@ -58,6 +58,14 @@
 ** MH-E has been updated to MH-E version 8.4.
 See MH-E-NEWS for details.
 
+---
+** The unrmail command converts from BABYL to mboxrd rather than mboxo.
+Customize `unrmail-mbox-format' to change this.
+
+---
+** Similarly, customize `rmail-mbox-format' to influence some minor aspects
+of how Rmail displays non-MIME messages.
+
 +++
 ** New function `ses-rename-cell' to give SES cells arbitrary names.
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-12-07 03:56:57 +0000
+++ b/lisp/ChangeLog    2012-12-07 04:37:14 +0000
@@ -1,3 +1,11 @@
+2012-12-07  Glenn Morris  <address@hidden>
+
+       * mail/unrmail.el (unrmail-mbox-format): New option.  (Bug#6574)
+       (batch-unrmail, unrmail): Doc fixes.
+       (unrmail): Respect unrmail-mbox-format.
+       * mail/rmail.el (rmail-mbox-format): New option.
+       (rmail-show-message-1): Respect rmail-mbox-format.
+
 2012-12-07  Stefan Monnier  <address@hidden>
 
        * emacs-lisp/cl-macs.el (cl-tagbody): New macro.

=== modified file 'lisp/mail/rmail.el'
--- a/lisp/mail/rmail.el        2012-12-06 11:21:08 +0000
+++ b/lisp/mail/rmail.el        2012-12-07 04:37:14 +0000
@@ -2699,6 +2699,27 @@
   :group 'rmail
   :version "23.1")
 
+;; FIXME?
+;; rmail-show-mime-function does not unquote >From lines.  Should it?
+(defcustom rmail-mbox-format 'mboxrd
+  "The mbox format that your system uses.
+There is no way to determine this, so you should set the appropriate value.
+The formats quote lines containing \"From \" differently.
+The choices are:
+  `mboxo' : lines that start with \"From \" quoted as \">From \"
+  `mboxrd': lines that start with \">*From \" quoted with another \">\"
+The `mboxo' format is ambiguous, in that one cannot know whether
+a line starting with \">From \" originally had a \">\" or not.
+
+It is not critical to set this to the correct value; it only affects
+how Rmail displays lines starting with \">*From \" in non-MIME messages.
+
+See also `unrmail-mbox-format'."
+  :type '(choice (const 'mboxrd)
+                (const 'mboxro))
+  :version "24.4"
+  :group 'rmail)
+
 (defun rmail-show-message-1 (&optional msg)
   "Show message MSG (default: current message) using `rmail-view-buffer'.
 Return text to display in the minibuffer if MSG is out of
@@ -2791,11 +2812,15 @@
            ;; Prepare the separator (blank line) before the body.
            (goto-char (point-min))
            (insert "\n")
-           ;; Unquote quoted From lines
-           (while (re-search-forward "^>+From " nil t)
-             (beginning-of-line)
-             (delete-char 1)
-             (forward-line))
+           ;; Unquote quoted From lines.
+           (let ((fromline (if (eq 'mboxrd rmail-mbox-format)
+                               "^>+From "
+                             "^>From "))
+                 case-fold-search)
+             (while (re-search-forward fromline nil t)
+               (beginning-of-line)
+               (delete-char 1)
+               (forward-line)))
            (goto-char (point-min)))
          ;; Copy the headers to the front of the message view buffer.
          (rmail-copy-headers beg end)
@@ -3869,6 +3894,7 @@
          (msgnum rmail-current-message)
          (subject (concat "["
                           (let ((from (or (mail-fetch-field "From")
+                                          ;; FIXME - huh?
                                           (mail-fetch-field ">From"))))
                             (if from
                                 (concat (mail-strip-quoted-names from) ": ")

=== modified file 'lisp/mail/unrmail.el'
--- a/lisp/mail/unrmail.el      2012-04-19 17:20:26 +0000
+++ b/lisp/mail/unrmail.el      2012-12-07 04:37:14 +0000
@@ -1,6 +1,6 @@
-;;; unrmail.el --- convert Rmail Babyl files to mailbox files
+;;; unrmail.el --- convert Rmail Babyl files to mbox files
 
-;; Copyright (C) 1992, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2012 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: mail
@@ -26,7 +26,7 @@
 
 ;;;###autoload
 (defun batch-unrmail ()
-  "Convert old-style Rmail Babyl files to system inbox format.
+  "Convert old-style Rmail Babyl files to mbox format.
 Specify the input Rmail Babyl file names as command line arguments.
 For each Rmail file, the corresponding output file name
 is made by adding `.mail' at the end.
@@ -45,9 +45,26 @@
 (declare-function mail-mbox-from "mail-utils" ())
 (defvar rmime-magic-string)            ; in rmime.el, if you have it
 
+(defcustom unrmail-mbox-format 'mboxrd
+  "The mbox format that `unrmail' should produce.
+These formats separate messages using lines that start with \"From \".
+Therefore any lines in the message bodies that start with \"From \"
+must be quoted.  The `mboxo' format just prepends a \">\" to such lines.
+This is not reversible, because given a line starting with \">From \" in
+an mboxo file, it is not possible to know whether the original had a \">\"
+or not.  The `mxbord' format avoids this by also quoting \">From \" as
+\">>From \", and so on.  For this reason, mboxrd is recommended.
+
+See also `rmail-mbox-format'."
+  :type '(choice (const 'mboxrd)
+                (const 'mboxro))
+  :version "24.4"
+  :group 'rmail)
+
 ;;;###autoload
 (defun unrmail (file to-file)
-  "Convert old-style Rmail Babyl file FILE to system inbox format file 
TO-FILE."
+  "Convert old-style Rmail Babyl file FILE to mbox format file TO-FILE.
+The variable `unrmail-mbox-format' controls which mbox format to use."
   (interactive "fUnrmail (babyl file): \nFUnrmail into (new mailbox file): ")
   (with-temp-buffer
     ;; Read in the old Rmail file with no decoding.
@@ -224,13 +241,15 @@
            (when keywords
              (insert "X-RMAIL-KEYWORDS: " keywords "\n"))
            (goto-char (point-min))
-           ;; ``Quote'' "\nFrom " as "\n>From "
-           ;;  (note that this isn't really quoting, as there is no requirement
-           ;;   that "\n[>]+From " be quoted in the same transparent way.)
-           (let ((case-fold-search nil))
-             (while (search-forward "\nFrom " nil t)
-               (forward-char -5)
-               (insert ?>)))
+           ;; Convert From to >From, etc.
+           (let ((case-fold-search nil)
+                 (fromline (if (eq 'mboxrd unrmail-mbox-format)
+                           "^>*From "
+                         "^From ")))
+             (while (re-search-forward fromline nil t)
+               (beginning-of-line)
+               (insert ?>)
+               (forward-line 1)))
            (goto-char (point-max))
            ;; Add terminator blank line to message.
            (insert "\n")


reply via email to

[Prev in Thread] Current Thread [Next in Thread]