diff options
| author | Glenn Morris | 2009-02-19 03:29:58 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-02-19 03:29:58 +0000 |
| commit | 92ef96ee8ece5cfd8fcd728fcf35cbac373d4041 (patch) | |
| tree | 1ec63a5618b182fd8673ed1ecbeea339aa2549bb | |
| parent | e73521d025cbb104701514673c70085e83a4eeab (diff) | |
| download | emacs-92ef96ee8ece5cfd8fcd728fcf35cbac373d4041.tar.gz emacs-92ef96ee8ece5cfd8fcd728fcf35cbac373d4041.zip | |
(rmail-get-new-mail-filter-spam): Move here from rmail.el.
| -rw-r--r-- | lisp/mail/rmail-spam-filter.el | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lisp/mail/rmail-spam-filter.el b/lisp/mail/rmail-spam-filter.el index f6c2c819904..bd2dfaa12f8 100644 --- a/lisp/mail/rmail-spam-filter.el +++ b/lisp/mail/rmail-spam-filter.el | |||
| @@ -351,6 +351,30 @@ it from rmail file. Called for each new message retrieved by | |||
| 351 | (setq return-value t))) | 351 | (setq return-value t))) |
| 352 | return-value)) | 352 | return-value)) |
| 353 | 353 | ||
| 354 | (defun rmail-get-new-mail-filter-spam (nnew) | ||
| 355 | "Check the most NNEW recent messages for spam." | ||
| 356 | (let* ((nold (- rmail-total-messages nnew)) | ||
| 357 | (nspam 0) | ||
| 358 | (nscan (1+ nold))) | ||
| 359 | (while (<= nscan rmail-total-messages) | ||
| 360 | (or (rmail-spam-filter nscan) | ||
| 361 | (setq nspam (1+ nspam))) | ||
| 362 | (setq nscan (1+ nscan))) | ||
| 363 | (when (> nspam 0) | ||
| 364 | ;; Otherwise the expunge prompt leaves the raw mbox buffer showing. | ||
| 365 | (rmail-show-message (rmail-first-unseen-message) 1) | ||
| 366 | (if (rmail-expunge-confirmed) (rmail-only-expunge t)) | ||
| 367 | ;; Swap back, else get-new-mail-1 gets confused. | ||
| 368 | (rmail-swap-buffers-maybe) | ||
| 369 | (widen)) | ||
| 370 | ;; Return a message based on the number of spam messages found. | ||
| 371 | (cond | ||
| 372 | ((zerop nspam) "") | ||
| 373 | ((= 1 nnew) ", and it appears to be spam") | ||
| 374 | ((= nspam nnew) ", and all appear to be spam") | ||
| 375 | (t (format ", and %d appear%s to be spam" nspam | ||
| 376 | (if (= 1 nspam) "s" "")))))) | ||
| 377 | |||
| 354 | ;; define functions for interactively adding sender/subject of a | 378 | ;; define functions for interactively adding sender/subject of a |
| 355 | ;; specific message to the spam definitions while reading it, using | 379 | ;; specific message to the spam definitions while reading it, using |
| 356 | ;; the menubar: | 380 | ;; the menubar: |