emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp/mail rmail-spam-filter.el


From: Glenn Morris
Subject: [Emacs-diffs] emacs/lisp/mail rmail-spam-filter.el
Date: Thu, 19 Feb 2009 03:29:59 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       09/02/19 03:29:59

Modified files:
        lisp/mail      : rmail-spam-filter.el 

Log message:
        (rmail-get-new-mail-filter-spam): Move here from rmail.el.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/mail/rmail-spam-filter.el?cvsroot=emacs&r1=1.27&r2=1.28

Patches:
Index: rmail-spam-filter.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/mail/rmail-spam-filter.el,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- rmail-spam-filter.el        18 Feb 2009 08:01:56 -0000      1.27
+++ rmail-spam-filter.el        19 Feb 2009 03:29:58 -0000      1.28
@@ -351,6 +351,30 @@
         (setq return-value t)))
     return-value))
 
+(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" ""))))))
+
 ;; define functions for interactively adding sender/subject of a
 ;; specific message to the spam definitions while reading it, using
 ;; the menubar:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]