diff options
author | Glenn Morris <rgm@gnu.org> | 2009-02-15 03:26:17 +0000 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2009-02-15 03:26:17 +0000 |
commit | 050f62bf25833561382dc73e4026d2d5590f9ec1 (patch) | |
tree | 76cec61634927b0220754ae5d974513fc514702b /lisp/mail/rmailout.el | |
parent | 8f8cecb318f4e69962a6997bcec066c20f33eded (diff) | |
download | emacs-050f62bf25833561382dc73e4026d2d5590f9ec1.tar.gz |
(rmail-output-as-mbox): Start search from point-min. If constructing a
"From " line, prefer the date header over the current time.
Diffstat (limited to 'lisp/mail/rmailout.el')
-rw-r--r-- | lisp/mail/rmailout.el | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el index 31de99e7d29..747d84cb968 100644 --- a/lisp/mail/rmailout.el +++ b/lisp/mail/rmailout.el @@ -307,45 +307,37 @@ It alters the current buffer's text, so call with a temp buffer current. If FILE-NAME is visited, output into its buffer instead. AS-SEEN is non-nil if we are copying the message \"as seen\"." (let ((case-fold-search t) - mail-from mime-version content-type) - + from date) + (goto-char (point-min)) ;; Preserve the Mail-From and MIME-Version fields ;; even if they have been pruned. (search-forward "\n\n" nil 'move) (narrow-to-region (point-min) (point)) - (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")) (widen) - ;; Make sure message ends with blank line. (goto-char (point-max)) (unless (bolp) (insert "\n")) (unless (looking-back "\n\n") (insert "\n")) - - ;; Generate a From line from other header fields - ;; if necessary. (goto-char (point-min)) - (unless (looking-at "From ") - (insert "From " - (mail-strip-quoted-names - (save-excursion - (save-restriction - (goto-char (point-min)) - (narrow-to-region - (point) - (or (search-forward "\n\n" nil) - (point-max))) - (or (mail-fetch-field "from") - (mail-fetch-field "really-from") - (mail-fetch-field "sender") - "unknown")))) - " " (current-time-string) "\n")) - (let ((buf (find-buffer-visiting file-name)) (tembuf (current-buffer))) (if (null buf) |