changeset 102111:206623e4bc00

(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.
author Glenn Morris <rgm@gnu.org>
date Thu, 19 Feb 2009 03:30:41 +0000
parents 4df6195e1d5e
children c9da83f185a6
files lisp/mail/rmail.el
diffstat 1 files changed, 5 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmail.el	Thu Feb 19 03:29:58 2009 +0000
+++ b/lisp/mail/rmail.el	Thu Feb 19 03:30:41 2009 +0000
@@ -89,9 +89,6 @@
 (defvar mail-abbrev-syntax-table)
 (defvar mail-abbrevs)
 (defvar messages-head)
-(defvar rmail-use-spam-filter)
-(defvar rsf-beep)
-(defvar rsf-sleep-after-message)
 (defvar total-messages)
 (defvar tool-bar-map)
 
@@ -1555,7 +1552,6 @@
 
 ;;;; *** Rmail input ***
 
-(declare-function rmail-spam-filter "rmail-spam-filter" (msg))
 (declare-function rmail-summary-goto-msg "rmailsum" (&optional n nowarn skip-rmail))
 (declare-function rmail-summary-mark-undeleted "rmailsum" (n))
 (declare-function rmail-summary-mark-deleted "rmailsum" (&optional n undel))
@@ -1643,6 +1639,9 @@
       ;; Don't leave the buffer screwed up if we get a disk-full error.
       (rmail-show-message))))
 
+(defvar rmail-use-spam-filter)
+(declare-function rmail-get-new-mail-filter-spam "rmail-spam-filter" (nnew))
+
 (defun rmail-get-new-mail-1 (file-name files delete-files)
   "Return t if new messages are detected without error, nil otherwise."
   (save-excursion
@@ -1700,47 +1699,16 @@
 	(if (zerop new-messages)
 	    (when (or file-name rmail-inbox-list)
 	      (message "(No new mail has arrived)"))
-	  ;; Generate the spam message.
-	  (setq blurb (if spam-filter-p
-			  (rmail-get-new-mail-filter-spam new-messages)
-			"")))
+	  (if spam-filter-p
+	      (setq blurb (rmail-get-new-mail-filter-spam new-messages))))
 	(if (rmail-summary-exists)
 	    (rmail-select-summary (rmail-update-summary)))
 	(setq suffix (if (= 1 new-messages) "" "s"))
 	(message "%d new message%s read%s" new-messages suffix blurb)
-	(unless (string-equal blurb "") ; there was spam
-	  (if rsf-beep (beep t))
-	  ;; The use of rmail-show-message in rmail-get-new-mail-filter-spam
-	  ;; also prevents the raw mbox buffer from showing at this point.
-	  (sleep-for rsf-sleep-after-message))
 	;; Establish the return value.
 	(setq result (> new-messages 0))
 	result))))
 
-(defun rmail-get-new-mail-filter-spam (nnew)
-  "Check the most NNEW recent messages for spam."
-  (let* ((nold (- rmail-total-messages nnew))
-	 (nspam 0)
-	 (nscan (1+ nold)))
-    (while (<= nscan rmail-total-messages)
-      (or (rmail-spam-filter nscan)
-	  (setq nspam (1+ nspam)))
-      (setq nscan (1+ nscan)))
-    (when (> nspam 0)
-      ;; Otherwise the expunge prompt leaves the raw mbox buffer showing.
-      (rmail-show-message (rmail-first-unseen-message) 1)
-      (if (rmail-expunge-confirmed) (rmail-only-expunge t))
-      ;; Swap back, else get-new-mail-1 gets confused.
-      (rmail-swap-buffers-maybe)
-      (widen))
-    ;; Return a message based on the number of spam messages found.
-    (cond
-     ((zerop nspam) "")
-     ((= 1 nnew) ", and it appears to be spam")
-     ((= nspam nnew) ", and all appear to be spam")
-     (t (format ", and %d appear%s to be spam" nspam
-		(if (= 1 nspam) "s" ""))))))
-
 (defun rmail-parse-url (file)
   "Parse the supplied URL. Return (list MAILBOX-NAME REMOTE PASSWORD GOT-PASSWORD)
 WHERE MAILBOX-NAME is the name of the mailbox suitable as argument to the