Mercurial > emacs
changeset 101766:4c8d51496578
(rmail-convert-babyl-to-mbox): Disable undo while
inserting the converted mailbox.
(rmail-get-new-mail): Restore the loop over inboxes when two or more
have the same basename. (Bug#2164)
Set the return value according to whether any mail was found,
not just in the last inbox. Only show a message and run the hook after
checking all inboxes.
(rmail-get-new-mail-1): Move message display and running the hook to
rmail-get-new-mail.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 03 Feb 2009 04:07:25 +0000 |
parents | 119f13a715df |
children | 4958df99b14c |
files | lisp/mail/rmail.el |
diffstat | 1 files changed, 41 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/mail/rmail.el Tue Feb 03 04:07:02 2009 +0000 +++ b/lisp/mail/rmail.el Tue Feb 03 04:07:25 2009 +0000 @@ -919,7 +919,8 @@ (unrmail old-file new-file) (message "Replacing BABYL format with mbox format...") (let ((inhibit-read-only t) - (coding-system-for-read 'raw-text)) + (coding-system-for-read 'raw-text) + (buffer-undo-list t)) (erase-buffer) (insert-file-contents new-file) ;; Rmail buffers need to be saved with Unix EOLs, or else @@ -1575,34 +1576,44 @@ (rmail-enable-multibyte (default-value 'enable-multibyte-characters)) found) (unwind-protect - (when all-files - (let ((opoint (point)) - ;; If buffer has not changed yet, and has not been - ;; saved yet, don't replace the old backup file now. - (make-backup-files (and make-backup-files (buffer-modified-p))) - (buffer-read-only nil) - ;; Don't make undo records while getting mail. - (buffer-undo-list t) - delete-files success files file-last-names) - ;; Pull files off all-files onto files as long as there is - ;; no name conflict. A conflict happens when two inbox - ;; file names have the same last component. - (while (and all-files - (not (member (file-name-nondirectory (car all-files)) - file-last-names))) - (setq files (cons (car all-files) files) - file-last-names - (cons (file-name-nondirectory (car all-files)) files)) - (setq all-files (cdr all-files))) - ;; Put them back in their original order. - (setq files (nreverse files)) - (goto-char (point-max)) - (skip-chars-backward " \t\n") ; just in case of brain damage - (delete-region (point) (point-max)) ; caused by require-final-newline - (setq found (rmail-get-new-mail-1 file-name files delete-files)))) - found) - ;; Don't leave the buffer screwed up if we get a disk-full error. - (or found (rmail-show-message-maybe)))) + (progn + ;; This loops if any members of the inbox list have the same + ;; basename (see "name conflict" below). + (while all-files + (let ((opoint (point)) + ;; If buffer has not changed yet, and has not been + ;; saved yet, don't replace the old backup file now. + (make-backup-files (and make-backup-files (buffer-modified-p))) + (buffer-read-only nil) + ;; Don't make undo records while getting mail. + (buffer-undo-list t) + delete-files success files file-last-names) + ;; Pull files off all-files onto files as long as there is + ;; no name conflict. A conflict happens when two inbox + ;; file names have the same last component. + ;; FIXME why does this "conflict" need kid gloves? + (while (and all-files + (not (member (file-name-nondirectory (car all-files)) + file-last-names))) + (setq files (cons (car all-files) files) + file-last-names + (cons (file-name-nondirectory (car all-files)) files)) + (setq all-files (cdr all-files))) + ;; Put them back in their original order. + (setq files (nreverse files)) + (goto-char (point-max)) + (skip-chars-backward " \t\n") ; just in case of brain damage + (delete-region (point) (point-max)) ; caused by require-final-newline + (setq found (or + (rmail-get-new-mail-1 file-name files delete-files) + found)))) + ;; Move to the first new message unless we have other unseen + ;; messages before it. + (if found (rmail-show-message-maybe (rmail-first-unseen-message))) + (run-hooks 'rmail-after-get-new-mail-hook) + found) + ;; Don't leave the buffer screwed up if we get a disk-full error. + (rmail-show-message-maybe)))) (defun rmail-get-new-mail-1 (file-name files delete-files) "Return t if new messages are detected without error, nil otherwise." @@ -1673,12 +1684,8 @@ (if rsf-beep (beep t)) (sleep-for rsf-sleep-after-message)) - ;; Establish the return value and move to the first new - ;; message unless we have other unseen messages before it. + ;; Establish the return value. (setq result (> new-messages 0)) - (when result - (rmail-show-message-maybe (rmail-first-unseen-message))) - (run-hooks 'rmail-after-get-new-mail-hook) result)))) (defun rmail-get-new-mail-filter-spam (new-message-count)