diff options
| author | Glenn Morris | 2009-03-05 03:43:01 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-03-05 03:43:01 +0000 |
| commit | 7184dd77fb8a6fd85d92f81d782b29a697cf3f1e (patch) | |
| tree | c8fbb9d23609c9c8d944258009c54c0042010a5b | |
| parent | f4ce6150a217bd258abf5514bf992664cbca0211 (diff) | |
| download | emacs-7184dd77fb8a6fd85d92f81d782b29a697cf3f1e.tar.gz emacs-7184dd77fb8a6fd85d92f81d782b29a697cf3f1e.zip | |
(rmail-output-as-mbox): Use rmail-ensure-blank-line.
(rmail-output-to-rmail-buffer): Add the new message at the end of the
existing messages, ensuring there is a blank line between them. (Bug#2521)
| -rw-r--r-- | lisp/mail/rmailout.el | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el index 0d44ae3a6ff..4f753f1e0f0 100644 --- a/lisp/mail/rmailout.el +++ b/lisp/mail/rmailout.el | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | :type 'boolean | 33 | :type 'boolean |
| 34 | :group 'rmail-output) | 34 | :group 'rmail-output) |
| 35 | 35 | ||
| 36 | ;; FIXME risky? | ||
| 36 | (defcustom rmail-output-file-alist nil | 37 | (defcustom rmail-output-file-alist nil |
| 37 | "Alist matching regexps to suggested output Rmail files. | 38 | "Alist matching regexps to suggested output Rmail files. |
| 38 | This is a list of elements of the form (REGEXP . NAME-EXP). | 39 | This is a list of elements of the form (REGEXP . NAME-EXP). |
| @@ -335,15 +336,13 @@ AS-SEEN is non-nil if we are copying the message \"as seen\"." | |||
| 335 | (widen) | 336 | (widen) |
| 336 | ;; Make sure message ends with blank line. | 337 | ;; Make sure message ends with blank line. |
| 337 | (goto-char (point-max)) | 338 | (goto-char (point-max)) |
| 338 | (unless (bolp) | 339 | (rmail-ensure-blank-line) |
| 339 | (insert "\n")) | ||
| 340 | (unless (looking-back "\n\n") | ||
| 341 | (insert "\n")) | ||
| 342 | (goto-char (point-min)) | 340 | (goto-char (point-min)) |
| 343 | (let ((buf (find-buffer-visiting file-name)) | 341 | (let ((buf (find-buffer-visiting file-name)) |
| 344 | (tembuf (current-buffer))) | 342 | (tembuf (current-buffer))) |
| 345 | (if (null buf) | 343 | (if (null buf) |
| 346 | (let ((coding-system-for-write 'raw-text-unix)) | 344 | (let ((coding-system-for-write 'raw-text-unix)) |
| 345 | ;; FIXME should ensure existing file ends with a blank line. | ||
| 347 | (write-region (point-min) (point-max) file-name t nomsg)) | 346 | (write-region (point-min) (point-max) file-name t nomsg)) |
| 348 | (if (eq buf (current-buffer)) | 347 | (if (eq buf (current-buffer)) |
| 349 | (error "Can't output message to same file it's already in")) | 348 | (error "Can't output message to same file it's already in")) |
| @@ -367,15 +366,22 @@ Do what is necessary to make Rmail know about the new message. then | |||
| 367 | display message number MSG." | 366 | display message number MSG." |
| 368 | (save-excursion | 367 | (save-excursion |
| 369 | (rmail-swap-buffers-maybe) | 368 | (rmail-swap-buffers-maybe) |
| 370 | ;; Turn on Auto Save mode, if it's off in this | 369 | ;; Turn on Auto Save mode, if it's off in this buffer but enabled |
| 371 | ;; buffer but enabled by default. | 370 | ;; by default. |
| 372 | (and (not buffer-auto-save-file-name) | 371 | (and (not buffer-auto-save-file-name) |
| 373 | auto-save-default | 372 | auto-save-default |
| 374 | (auto-save-mode t)) | 373 | (auto-save-mode t)) |
| 375 | (rmail-maybe-set-message-counters) | 374 | (rmail-maybe-set-message-counters) |
| 375 | ;; Insert the new message after the last old message. | ||
| 376 | (widen) | ||
| 377 | ;; Make sure the last old message ends with a blank line. | ||
| 378 | (goto-char (point-max)) | ||
| 379 | (rmail-ensure-blank-line) | ||
| 380 | ;; Insert the new message at the end. | ||
| 376 | (narrow-to-region (point-max) (point-max)) | 381 | (narrow-to-region (point-max) (point-max)) |
| 377 | (insert-buffer-substring tembuf) | 382 | (insert-buffer-substring tembuf) |
| 378 | (rmail-count-new-messages t) | 383 | (rmail-count-new-messages t) |
| 384 | ;; FIXME should re-use existing windows. | ||
| 379 | (if (rmail-summary-exists) | 385 | (if (rmail-summary-exists) |
| 380 | (rmail-select-summary (rmail-update-summary))) | 386 | (rmail-select-summary (rmail-update-summary))) |
| 381 | (rmail-show-message-1 msg))) | 387 | (rmail-show-message-1 msg))) |