diff options
| author | Glenn Morris | 2009-02-19 03:30:41 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-02-19 03:30:41 +0000 |
| commit | 25833b8cd8ccbdf98b9501f79f879709af5eb984 (patch) | |
| tree | 4f44f2ff463f18eba85ff1d8bb60af6282b8d001 | |
| parent | 92ef96ee8ece5cfd8fcd728fcf35cbac373d4041 (diff) | |
| download | emacs-25833b8cd8ccbdf98b9501f79f879709af5eb984.tar.gz emacs-25833b8cd8ccbdf98b9501f79f879709af5eb984.zip | |
(rsf-beep, rsf-sleep-after-message, rmail-spam-filter): Don't declare.
(rmail-get-new-mail-filter-spam): Declare. Move definition to
rmail-spam-filter.el.
(rmail-get-new-mail-1): Move the beep and sleep to
rmail-get-new-mail-filter-spam.
| -rw-r--r-- | lisp/mail/rmail.el | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 3e41ad44201..935599f038d 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -89,9 +89,6 @@ its character representation and its display representation.") | |||
| 89 | (defvar mail-abbrev-syntax-table) | 89 | (defvar mail-abbrev-syntax-table) |
| 90 | (defvar mail-abbrevs) | 90 | (defvar mail-abbrevs) |
| 91 | (defvar messages-head) | 91 | (defvar messages-head) |
| 92 | (defvar rmail-use-spam-filter) | ||
| 93 | (defvar rsf-beep) | ||
| 94 | (defvar rsf-sleep-after-message) | ||
| 95 | (defvar total-messages) | 92 | (defvar total-messages) |
| 96 | (defvar tool-bar-map) | 93 | (defvar tool-bar-map) |
| 97 | 94 | ||
| @@ -1555,7 +1552,6 @@ The duplicate copy goes into the Rmail file just after the original." | |||
| 1555 | 1552 | ||
| 1556 | ;;;; *** Rmail input *** | 1553 | ;;;; *** Rmail input *** |
| 1557 | 1554 | ||
| 1558 | (declare-function rmail-spam-filter "rmail-spam-filter" (msg)) | ||
| 1559 | (declare-function rmail-summary-goto-msg "rmailsum" (&optional n nowarn skip-rmail)) | 1555 | (declare-function rmail-summary-goto-msg "rmailsum" (&optional n nowarn skip-rmail)) |
| 1560 | (declare-function rmail-summary-mark-undeleted "rmailsum" (n)) | 1556 | (declare-function rmail-summary-mark-undeleted "rmailsum" (n)) |
| 1561 | (declare-function rmail-summary-mark-deleted "rmailsum" (&optional n undel)) | 1557 | (declare-function rmail-summary-mark-deleted "rmailsum" (&optional n undel)) |
| @@ -1643,6 +1639,9 @@ It returns t if it got any new messages." | |||
| 1643 | ;; Don't leave the buffer screwed up if we get a disk-full error. | 1639 | ;; Don't leave the buffer screwed up if we get a disk-full error. |
| 1644 | (rmail-show-message)))) | 1640 | (rmail-show-message)))) |
| 1645 | 1641 | ||
| 1642 | (defvar rmail-use-spam-filter) | ||
| 1643 | (declare-function rmail-get-new-mail-filter-spam "rmail-spam-filter" (nnew)) | ||
| 1644 | |||
| 1646 | (defun rmail-get-new-mail-1 (file-name files delete-files) | 1645 | (defun rmail-get-new-mail-1 (file-name files delete-files) |
| 1647 | "Return t if new messages are detected without error, nil otherwise." | 1646 | "Return t if new messages are detected without error, nil otherwise." |
| 1648 | (save-excursion | 1647 | (save-excursion |
| @@ -1700,47 +1699,16 @@ It returns t if it got any new messages." | |||
| 1700 | (if (zerop new-messages) | 1699 | (if (zerop new-messages) |
| 1701 | (when (or file-name rmail-inbox-list) | 1700 | (when (or file-name rmail-inbox-list) |
| 1702 | (message "(No new mail has arrived)")) | 1701 | (message "(No new mail has arrived)")) |
| 1703 | ;; Generate the spam message. | 1702 | (if spam-filter-p |
| 1704 | (setq blurb (if spam-filter-p | 1703 | (setq blurb (rmail-get-new-mail-filter-spam new-messages)))) |
| 1705 | (rmail-get-new-mail-filter-spam new-messages) | ||
| 1706 | ""))) | ||
| 1707 | (if (rmail-summary-exists) | 1704 | (if (rmail-summary-exists) |
| 1708 | (rmail-select-summary (rmail-update-summary))) | 1705 | (rmail-select-summary (rmail-update-summary))) |
| 1709 | (setq suffix (if (= 1 new-messages) "" "s")) | 1706 | (setq suffix (if (= 1 new-messages) "" "s")) |
| 1710 | (message "%d new message%s read%s" new-messages suffix blurb) | 1707 | (message "%d new message%s read%s" new-messages suffix blurb) |
| 1711 | (unless (string-equal blurb "") ; there was spam | ||
| 1712 | (if rsf-beep (beep t)) | ||
| 1713 | ;; The use of rmail-show-message in rmail-get-new-mail-filter-spam | ||
| 1714 | ;; also prevents the raw mbox buffer from showing at this point. | ||
| 1715 | (sleep-for rsf-sleep-after-message)) | ||
| 1716 | ;; Establish the return value. | 1708 | ;; Establish the return value. |
| 1717 | (setq result (> new-messages 0)) | 1709 | (setq result (> new-messages 0)) |
| 1718 | result)))) | 1710 | result)))) |
| 1719 | 1711 | ||
| 1720 | (defun rmail-get-new-mail-filter-spam (nnew) | ||
| 1721 | "Check the most NNEW recent messages for spam." | ||
| 1722 | (let* ((nold (- rmail-total-messages nnew)) | ||
| 1723 | (nspam 0) | ||
| 1724 | (nscan (1+ nold))) | ||
| 1725 | (while (<= nscan rmail-total-messages) | ||
| 1726 | (or (rmail-spam-filter nscan) | ||
| 1727 | (setq nspam (1+ nspam))) | ||
| 1728 | (setq nscan (1+ nscan))) | ||
| 1729 | (when (> nspam 0) | ||
| 1730 | ;; Otherwise the expunge prompt leaves the raw mbox buffer showing. | ||
| 1731 | (rmail-show-message (rmail-first-unseen-message) 1) | ||
| 1732 | (if (rmail-expunge-confirmed) (rmail-only-expunge t)) | ||
| 1733 | ;; Swap back, else get-new-mail-1 gets confused. | ||
| 1734 | (rmail-swap-buffers-maybe) | ||
| 1735 | (widen)) | ||
| 1736 | ;; Return a message based on the number of spam messages found. | ||
| 1737 | (cond | ||
| 1738 | ((zerop nspam) "") | ||
| 1739 | ((= 1 nnew) ", and it appears to be spam") | ||
| 1740 | ((= nspam nnew) ", and all appear to be spam") | ||
| 1741 | (t (format ", and %d appear%s to be spam" nspam | ||
| 1742 | (if (= 1 nspam) "s" "")))))) | ||
| 1743 | |||
| 1744 | (defun rmail-parse-url (file) | 1712 | (defun rmail-parse-url (file) |
| 1745 | "Parse the supplied URL. Return (list MAILBOX-NAME REMOTE PASSWORD GOT-PASSWORD) | 1713 | "Parse the supplied URL. Return (list MAILBOX-NAME REMOTE PASSWORD GOT-PASSWORD) |
| 1746 | WHERE MAILBOX-NAME is the name of the mailbox suitable as argument to the | 1714 | WHERE MAILBOX-NAME is the name of the mailbox suitable as argument to the |