Commit bad4f1fd authored by Glenn Morris's avatar Glenn Morris
Browse files

(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.
parent c36e6767
...@@ -919,7 +919,8 @@ Convert Babyl mail file to mbox format? ") ...@@ -919,7 +919,8 @@ Convert Babyl mail file to mbox format? ")
(unrmail old-file new-file) (unrmail old-file new-file)
(message "Replacing BABYL format with mbox format...") (message "Replacing BABYL format with mbox format...")
(let ((inhibit-read-only t) (let ((inhibit-read-only t)
(coding-system-for-read 'raw-text)) (coding-system-for-read 'raw-text)
(buffer-undo-list t))
(erase-buffer) (erase-buffer)
(insert-file-contents new-file) (insert-file-contents new-file)
;; Rmail buffers need to be saved with Unix EOLs, or else ;; Rmail buffers need to be saved with Unix EOLs, or else
...@@ -1575,34 +1576,44 @@ It returns t if it got any new messages." ...@@ -1575,34 +1576,44 @@ It returns t if it got any new messages."
(rmail-enable-multibyte (default-value 'enable-multibyte-characters)) (rmail-enable-multibyte (default-value 'enable-multibyte-characters))
found) found)
(unwind-protect (unwind-protect
(when all-files (progn
(let ((opoint (point)) ;; This loops if any members of the inbox list have the same
;; If buffer has not changed yet, and has not been ;; basename (see "name conflict" below).
;; saved yet, don't replace the old backup file now. (while all-files
(make-backup-files (and make-backup-files (buffer-modified-p))) (let ((opoint (point))
(buffer-read-only nil) ;; If buffer has not changed yet, and has not been
;; Don't make undo records while getting mail. ;; saved yet, don't replace the old backup file now.
(buffer-undo-list t) (make-backup-files (and make-backup-files (buffer-modified-p)))
delete-files success files file-last-names) (buffer-read-only nil)
;; Pull files off all-files onto files as long as there is ;; Don't make undo records while getting mail.
;; no name conflict. A conflict happens when two inbox (buffer-undo-list t)
;; file names have the same last component. delete-files success files file-last-names)
(while (and all-files ;; Pull files off all-files onto files as long as there is
(not (member (file-name-nondirectory (car all-files)) ;; no name conflict. A conflict happens when two inbox
file-last-names))) ;; file names have the same last component.
(setq files (cons (car all-files) files) ;; FIXME why does this "conflict" need kid gloves?
file-last-names (while (and all-files
(cons (file-name-nondirectory (car all-files)) files)) (not (member (file-name-nondirectory (car all-files))
(setq all-files (cdr all-files))) file-last-names)))
;; Put them back in their original order. (setq files (cons (car all-files) files)
(setq files (nreverse files)) file-last-names
(goto-char (point-max)) (cons (file-name-nondirectory (car all-files)) files))
(skip-chars-backward " \t\n") ; just in case of brain damage (setq all-files (cdr all-files)))
(delete-region (point) (point-max)) ; caused by require-final-newline ;; Put them back in their original order.
(setq found (rmail-get-new-mail-1 file-name files delete-files)))) (setq files (nreverse files))
found) (goto-char (point-max))
;; Don't leave the buffer screwed up if we get a disk-full error. (skip-chars-backward " \t\n") ; just in case of brain damage
(or found (rmail-show-message-maybe)))) (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) (defun rmail-get-new-mail-1 (file-name files delete-files)
"Return t if new messages are detected without error, nil otherwise." "Return t if new messages are detected without error, nil otherwise."
...@@ -1673,12 +1684,8 @@ It returns t if it got any new messages." ...@@ -1673,12 +1684,8 @@ It returns t if it got any new messages."
(if rsf-beep (beep t)) (if rsf-beep (beep t))
(sleep-for rsf-sleep-after-message)) (sleep-for rsf-sleep-after-message))
;; Establish the return value and move to the first new ;; Establish the return value.
;; message unless we have other unseen messages before it.
(setq result (> new-messages 0)) (setq result (> new-messages 0))
(when result
(rmail-show-message-maybe (rmail-first-unseen-message)))
(run-hooks 'rmail-after-get-new-mail-hook)
result)))) result))))
(defun rmail-get-new-mail-filter-spam (new-message-count) (defun rmail-get-new-mail-filter-spam (new-message-count)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment