emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog mail/rmailout.el


From: Glenn Morris
Subject: [Emacs-diffs] emacs/lisp ChangeLog mail/rmailout.el
Date: Tue, 17 Feb 2009 02:54:17 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       09/02/17 02:54:16

Modified files:
        lisp           : ChangeLog 
        lisp/mail      : rmailout.el 

Log message:
        (rmail-mbox-from): New function.
        (rmail-output-as-mbox): Use rmail-mbox-from.
        (rmail-output): Ensure a From line in the not-rmail Babyl case.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15339&r2=1.15340
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/mail/rmailout.el?cvsroot=emacs&r1=1.94&r2=1.95

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15339
retrieving revision 1.15340
diff -u -b -r1.15339 -r1.15340
--- ChangeLog   17 Feb 2009 02:37:40 -0000      1.15339
+++ ChangeLog   17 Feb 2009 02:54:14 -0000      1.15340
@@ -4,6 +4,9 @@
        (rmail-delete-unwanted-fields): Ignore case.  Use line-beg-pos.
        (rmail-output, rmail-output-as-seen): Change the "from-gnus" argument to
        "not-rmail", and make it work.  Simplify.
+       (rmail-mbox-from): New function.
+       (rmail-output-as-mbox): Use rmail-mbox-from.
+       (rmail-output): Ensure a From line in the not-rmail Babyl case.
 
        * mail/rmail.el (rmail-get-attr-names): Give a warning rather than an
        error if the header is corrupt.

Index: mail/rmailout.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/mail/rmailout.el,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -b -r1.94 -r1.95
--- mail/rmailout.el    17 Feb 2009 02:36:51 -0000      1.94
+++ mail/rmailout.el    17 Feb 2009 02:54:16 -0000      1.95
@@ -308,6 +308,21 @@
                    "From: \\1\n"))
                t)))))))
 
+;; Note this is duplicated in unrmail.el.
+(defun rmail-mbox-from ()
+  "Return a \"From \" line for the current message.
+The buffer should be narrowed to just the header."
+  (let ((from (or (mail-fetch-field "from")
+                 (mail-fetch-field "really-from")
+                 (mail-fetch-field "sender")
+                 "unknown"))
+       (date (mail-fetch-field "date")))
+    (format "From %s %s\n" (mail-strip-quoted-names from)
+           (or (and date
+                    (ignore-errors
+                     (current-time-string (date-to-time date))))
+               (current-time-string)))))
+
 (defun rmail-output-as-mbox (file-name nomsg &optional as-seen)
   "Convert the current buffer's text to mbox and output to FILE-NAME.
 Alters the current buffer's text, so it should be a temporary buffer.
@@ -327,20 +342,9 @@
     (rmail-delete-unwanted-fields
      (if rmail-enable-mime "Mail-From"
        "Mail-From\\|MIME-Version\\|Content-type"))
-    ;; Generate a From line from other header fields if necessary.
-    ;; FIXME this duplicates code from unrmail.el.
     (goto-char (point-min))
-    (unless (looking-at "From ")
-      (setq from (or (mail-fetch-field "from")
-                    (mail-fetch-field "really-from")
-                    (mail-fetch-field "sender")
-                    "unknown")
-           date (mail-fetch-field "date")
-           date (or (and date
-                         (ignore-errors
-                          (current-time-string (date-to-time date))))
-                    (current-time-string)))
-      (insert "From " (mail-strip-quoted-names from) " " date "\n"))
+    (or (looking-at "From ")
+       (insert (rmail-mbox-from)))
     (widen)
     ;; Make sure message ends with blank line.
     (goto-char (point-max))
@@ -439,11 +443,16 @@
        (cur (current-buffer)))
     (if not-rmail               ; eg via message-fcc-handler-function
        (with-temp-buffer
-         ;; FIXME need to ensure a From line for rmail-convert-to-babyl-format.
          (insert-buffer-substring cur)
          ;; Output in the appropriate format.
          (if babyl-format
-             (rmail-output-as-babyl file-name noattribute)
+             (progn
+               (goto-char (point-min))
+               ;; rmail-convert-to-babyl-format errors if no From line,
+               ;; whereas rmail-output-as-mbox inserts one.
+               (or (looking-at "From ")
+                   (insert (rmail-mbox-from)))
+               (rmail-output-as-babyl file-name noattribute))
            (rmail-output-as-mbox file-name noattribute)))
       ;; Called from an Rmail buffer.
       (if rmail-buffer




reply via email to

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