diff options
| author | Glenn Morris | 2009-02-15 03:26:17 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-02-15 03:26:17 +0000 |
| commit | 050f62bf25833561382dc73e4026d2d5590f9ec1 (patch) | |
| tree | 76cec61634927b0220754ae5d974513fc514702b | |
| parent | 8f8cecb318f4e69962a6997bcec066c20f33eded (diff) | |
| download | emacs-050f62bf25833561382dc73e4026d2d5590f9ec1.tar.gz emacs-050f62bf25833561382dc73e4026d2d5590f9ec1.zip | |
(rmail-output-as-mbox): Start search from point-min. If constructing a
"From " line, prefer the date header over the current time.
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/mail/rmailout.el | 40 |
2 files changed, 18 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ff630eacc16..d097c18917d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -6,6 +6,8 @@ | |||
| 6 | (rmail-output-as-babyl, rmail-output-to-babyl-buffer): Remove | 6 | (rmail-output-as-babyl, rmail-output-to-babyl-buffer): Remove |
| 7 | unnecessary use of with-no-warnings. | 7 | unnecessary use of with-no-warnings. |
| 8 | (rmail-output-as-mbox, rmail-output-as-seen): Doc fix. | 8 | (rmail-output-as-mbox, rmail-output-as-seen): Doc fix. |
| 9 | (rmail-output-as-mbox): Start search from point-min. If constructing a | ||
| 10 | "From " line, prefer the date header over the current time. | ||
| 9 | 11 | ||
| 10 | 2009-02-15 Richard M Stallman <rms@gnu.org> | 12 | 2009-02-15 Richard M Stallman <rms@gnu.org> |
| 11 | 13 | ||
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. | |||
| 307 | If FILE-NAME is visited, output into its buffer instead. | 307 | If FILE-NAME is visited, output into its buffer instead. |
| 308 | AS-SEEN is non-nil if we are copying the message \"as seen\"." | 308 | AS-SEEN is non-nil if we are copying the message \"as seen\"." |
| 309 | (let ((case-fold-search t) | 309 | (let ((case-fold-search t) |
| 310 | mail-from mime-version content-type) | 310 | from date) |
| 311 | 311 | (goto-char (point-min)) | |
| 312 | ;; Preserve the Mail-From and MIME-Version fields | 312 | ;; Preserve the Mail-From and MIME-Version fields |
| 313 | ;; even if they have been pruned. | 313 | ;; even if they have been pruned. |
| 314 | (search-forward "\n\n" nil 'move) | 314 | (search-forward "\n\n" nil 'move) |
| 315 | (narrow-to-region (point-min) (point)) | 315 | (narrow-to-region (point-min) (point)) |
| 316 | |||
| 317 | (rmail-delete-unwanted-fields | 316 | (rmail-delete-unwanted-fields |
| 318 | (if rmail-enable-mime "Mail-From" | 317 | (if rmail-enable-mime "Mail-From" |
| 319 | "Mail-From\\|MIME-Version\\|Content-type")) | 318 | "Mail-From\\|MIME-Version\\|Content-type")) |
| 320 | 319 | ;; Generate a From line from other header fields if necessary. | |
| 320 | ;; FIXME this duplicates code from unrmail.el. | ||
| 321 | (goto-char (point-min)) | ||
| 322 | (unless (looking-at "From ") | ||
| 323 | (setq from (or (mail-fetch-field "from") | ||
| 324 | (mail-fetch-field "really-from") | ||
| 325 | (mail-fetch-field "sender") | ||
| 326 | "unknown") | ||
| 327 | date (mail-fetch-field "date") | ||
| 328 | date (or (and date | ||
| 329 | (ignore-errors | ||
| 330 | (current-time-string (date-to-time date)))) | ||
| 331 | (current-time-string))) | ||
| 332 | (insert "From " (mail-strip-quoted-names from) " " date "\n")) | ||
| 321 | (widen) | 333 | (widen) |
| 322 | |||
| 323 | ;; Make sure message ends with blank line. | 334 | ;; Make sure message ends with blank line. |
| 324 | (goto-char (point-max)) | 335 | (goto-char (point-max)) |
| 325 | (unless (bolp) | 336 | (unless (bolp) |
| 326 | (insert "\n")) | 337 | (insert "\n")) |
| 327 | (unless (looking-back "\n\n") | 338 | (unless (looking-back "\n\n") |
| 328 | (insert "\n")) | 339 | (insert "\n")) |
| 329 | |||
| 330 | ;; Generate a From line from other header fields | ||
| 331 | ;; if necessary. | ||
| 332 | (goto-char (point-min)) | 340 | (goto-char (point-min)) |
| 333 | (unless (looking-at "From ") | ||
| 334 | (insert "From " | ||
| 335 | (mail-strip-quoted-names | ||
| 336 | (save-excursion | ||
| 337 | (save-restriction | ||
| 338 | (goto-char (point-min)) | ||
| 339 | (narrow-to-region | ||
| 340 | (point) | ||
| 341 | (or (search-forward "\n\n" nil) | ||
| 342 | (point-max))) | ||
| 343 | (or (mail-fetch-field "from") | ||
| 344 | (mail-fetch-field "really-from") | ||
| 345 | (mail-fetch-field "sender") | ||
| 346 | "unknown")))) | ||
| 347 | " " (current-time-string) "\n")) | ||
| 348 | |||
| 349 | (let ((buf (find-buffer-visiting file-name)) | 341 | (let ((buf (find-buffer-visiting file-name)) |
| 350 | (tembuf (current-buffer))) | 342 | (tembuf (current-buffer))) |
| 351 | (if (null buf) | 343 | (if (null buf) |