diff options
| author | Glenn Morris | 2009-02-03 04:07:25 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-02-03 04:07:25 +0000 |
| commit | bad4f1fd32430616fb531c5f1a2fe99c0a36104e (patch) | |
| tree | 182c8a143847c829a5a1d891499792fc268e2465 | |
| parent | c36e676798aa19c49bdb16348c243abebc903f59 (diff) | |
| download | emacs-bad4f1fd32430616fb531c5f1a2fe99c0a36104e.tar.gz emacs-bad4f1fd32430616fb531c5f1a2fe99c0a36104e.zip | |
(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.
| -rw-r--r-- | lisp/mail/rmail.el | 75 |
1 files changed, 41 insertions, 34 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index cd7a8895afa..8e03dad5807 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -919,7 +919,8 @@ Convert Babyl mail file to mbox format? ") | |||
| 919 | (unrmail old-file new-file) | 919 | (unrmail old-file new-file) |
| 920 | (message "Replacing BABYL format with mbox format...") | 920 | (message "Replacing BABYL format with mbox format...") |
| 921 | (let ((inhibit-read-only t) | 921 | (let ((inhibit-read-only t) |
| 922 | (coding-system-for-read 'raw-text)) | 922 | (coding-system-for-read 'raw-text) |
| 923 | (buffer-undo-list t)) | ||
| 923 | (erase-buffer) | 924 | (erase-buffer) |
| 924 | (insert-file-contents new-file) | 925 | (insert-file-contents new-file) |
| 925 | ;; Rmail buffers need to be saved with Unix EOLs, or else | 926 | ;; 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 | (rmail-enable-multibyte (default-value 'enable-multibyte-characters)) | 1576 | (rmail-enable-multibyte (default-value 'enable-multibyte-characters)) |
| 1576 | found) | 1577 | found) |
| 1577 | (unwind-protect | 1578 | (unwind-protect |
| 1578 | (when all-files | 1579 | (progn |
| 1579 | (let ((opoint (point)) | 1580 | ;; This loops if any members of the inbox list have the same |
| 1580 | ;; If buffer has not changed yet, and has not been | 1581 | ;; basename (see "name conflict" below). |
| 1581 | ;; saved yet, don't replace the old backup file now. | 1582 | (while all-files |
| 1582 | (make-backup-files (and make-backup-files (buffer-modified-p))) | 1583 | (let ((opoint (point)) |
| 1583 | (buffer-read-only nil) | 1584 | ;; If buffer has not changed yet, and has not been |
| 1584 | ;; Don't make undo records while getting mail. | 1585 | ;; saved yet, don't replace the old backup file now. |
| 1585 | (buffer-undo-list t) | 1586 | (make-backup-files (and make-backup-files (buffer-modified-p))) |
| 1586 | delete-files success files file-last-names) | 1587 | (buffer-read-only nil) |
| 1587 | ;; Pull files off all-files onto files as long as there is | 1588 | ;; Don't make undo records while getting mail. |
| 1588 | ;; no name conflict. A conflict happens when two inbox | 1589 | (buffer-undo-list t) |
| 1589 | ;; file names have the same last component. | 1590 | delete-files success files file-last-names) |
| 1590 | (while (and all-files | 1591 | ;; Pull files off all-files onto files as long as there is |
| 1591 | (not (member (file-name-nondirectory (car all-files)) | 1592 | ;; no name conflict. A conflict happens when two inbox |
| 1592 | file-last-names))) | 1593 | ;; file names have the same last component. |
| 1593 | (setq files (cons (car all-files) files) | 1594 | ;; FIXME why does this "conflict" need kid gloves? |
| 1594 | file-last-names | 1595 | (while (and all-files |
| 1595 | (cons (file-name-nondirectory (car all-files)) files)) | 1596 | (not (member (file-name-nondirectory (car all-files)) |
| 1596 | (setq all-files (cdr all-files))) | 1597 | file-last-names))) |
| 1597 | ;; Put them back in their original order. | 1598 | (setq files (cons (car all-files) files) |
| 1598 | (setq files (nreverse files)) | 1599 | file-last-names |
| 1599 | (goto-char (point-max)) | 1600 | (cons (file-name-nondirectory (car all-files)) files)) |
| 1600 | (skip-chars-backward " \t\n") ; just in case of brain damage | 1601 | (setq all-files (cdr all-files))) |
| 1601 | (delete-region (point) (point-max)) ; caused by require-final-newline | 1602 | ;; Put them back in their original order. |
| 1602 | (setq found (rmail-get-new-mail-1 file-name files delete-files)))) | 1603 | (setq files (nreverse files)) |
| 1603 | found) | 1604 | (goto-char (point-max)) |
| 1604 | ;; Don't leave the buffer screwed up if we get a disk-full error. | 1605 | (skip-chars-backward " \t\n") ; just in case of brain damage |
| 1605 | (or found (rmail-show-message-maybe)))) | 1606 | (delete-region (point) (point-max)) ; caused by require-final-newline |
| 1607 | (setq found (or | ||
| 1608 | (rmail-get-new-mail-1 file-name files delete-files) | ||
| 1609 | found)))) | ||
| 1610 | ;; Move to the first new message unless we have other unseen | ||
| 1611 | ;; messages before it. | ||
| 1612 | (if found (rmail-show-message-maybe (rmail-first-unseen-message))) | ||
| 1613 | (run-hooks 'rmail-after-get-new-mail-hook) | ||
| 1614 | found) | ||
| 1615 | ;; Don't leave the buffer screwed up if we get a disk-full error. | ||
| 1616 | (rmail-show-message-maybe)))) | ||
| 1606 | 1617 | ||
| 1607 | (defun rmail-get-new-mail-1 (file-name files delete-files) | 1618 | (defun rmail-get-new-mail-1 (file-name files delete-files) |
| 1608 | "Return t if new messages are detected without error, nil otherwise." | 1619 | "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 | (if rsf-beep (beep t)) | 1684 | (if rsf-beep (beep t)) |
| 1674 | (sleep-for rsf-sleep-after-message)) | 1685 | (sleep-for rsf-sleep-after-message)) |
| 1675 | 1686 | ||
| 1676 | ;; Establish the return value and move to the first new | 1687 | ;; Establish the return value. |
| 1677 | ;; message unless we have other unseen messages before it. | ||
| 1678 | (setq result (> new-messages 0)) | 1688 | (setq result (> new-messages 0)) |
| 1679 | (when result | ||
| 1680 | (rmail-show-message-maybe (rmail-first-unseen-message))) | ||
| 1681 | (run-hooks 'rmail-after-get-new-mail-hook) | ||
| 1682 | result)))) | 1689 | result)))) |
| 1683 | 1690 | ||
| 1684 | (defun rmail-get-new-mail-filter-spam (new-message-count) | 1691 | (defun rmail-get-new-mail-filter-spam (new-message-count) |