From: Paul Reilly Date: Fri, 21 Feb 2003 18:44:45 +0000 (+0000) Subject: (rmail-get-new-mail): Integrate the rmail spam filter into rmail. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2d1e738084aba7235931f29d86149e8b6ea4e1e1;p=emacs.git (rmail-get-new-mail): Integrate the rmail spam filter into rmail. --- diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index cec69a39e7c..9a22176a6a9 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -1490,9 +1490,30 @@ It returns t if it got any new messages." (setq current-message (rmail-first-unseen-message)) (if (rmail-summary-exists) (with-current-buffer rmail-summary-buffer - (rmail-update-summary) + (rmail-update-summary))) + + ;; Process the new messages for spam using the + ;; integrated spam filter. The spam filter can mark + ;; messages for deletion and can output a message. + (if rmail-use-spam-filter + ;; Loop through the new messages processing each + ;; message for spam. + (save-excursion + (while (<= current-message rmail-total-messages) + (narrow-to-region + (rmail-desc-get-start current-message) + (rmail-desc-get-end current-message)) + (rmail-spam-filter current-message) + (setq current-message (1+ current-message))))) + + ;; Position the mail cursor again. + (setq current-message (rmail-first-unseen-message)) + (if (rmail-summary-exists) + (with-current-buffer rmail-summary-buffer (rmail-summary-goto-msg current-message)) (rmail-show-message current-message)) + + ;; Run the after get new mail hook. (run-hooks 'rmail-after-get-new-mail-hook) (message "%d new message%s read" new-messages (if (= 1 new-messages) "" "s"))