From cf26b8d0d77133cf3d69e92629ceb383fae49ffd Mon Sep 17 00:00:00 2001 From: Teodor Zlatanov Date: Mon, 27 Oct 2003 18:51:51 +0000 Subject: [PATCH] (spam-split): added the option of specifying a string as a spam-split parameter; such a string will override spam-split-group temporarily. --- lisp/ChangeLog | 3 +++ lisp/spam.el | 56 +++++++++++++++++++++++++++++--------------------- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bb901d8b6..63f4e4c23 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -3,6 +3,9 @@ * spam.el (spam-mark-spam-as-expired-and-move-routine) (spam-ham-copy-or-move-routine): don't ask when deleting copied articles, and use move instead of copy when possible + (spam-split): added the option of specifying a string as a + spam-split parameter; such a string will override + spam-split-group temporarily. * nnmail.el (nnmail-cache-insert): protect from nil message IDs, but should we do something else? diff --git a/lisp/spam.el b/lisp/spam.el index 121965e02..3fa4fb6e6 100644 --- a/lisp/spam.el +++ b/lisp/spam.el @@ -726,32 +726,42 @@ splitters that need to have the full message body available.") ;;;TODO: modify to invoke self with each specific check if invoked without specific checks (defun spam-split (&rest specific-checks) "Split this message into the `spam' group if it is spam. -This function can be used as an entry in `nnmail-split-fancy', for -example like this: (: spam-split). It can take checks as parameters. +This function can be used as an entry in `nnmail-split-fancy', +for example like this: (: spam-split). It can take checks as +parameters. A string as a parameter will set the +spam-split-group to that string. See the Info node `(gnus)Fancy Mail Splitting' for more details." (interactive) - (save-excursion - (save-restriction - (dolist (check spam-list-of-statistical-checks) - (when (symbol-value check) - (widen) - (gnus-message 8 "spam-split: widening the buffer (%s requires it)" - (symbol-name check)) - (return))) - ;; (progn (widen) (debug (buffer-string))) - (let ((list-of-checks spam-list-of-checks) - decision) - (while (and list-of-checks (not decision)) - (let ((pair (pop list-of-checks))) - (when (and (symbol-value (car pair)) - (or (null specific-checks) - (memq (car pair) specific-checks))) - (gnus-message 5 "spam-split: calling the %s function" (symbol-name (cdr pair))) - (setq decision (funcall (cdr pair)))))) - (if (eq decision t) - nil - decision))))) + (let ((spam-split-group-choice spam-split-group)) + (dolist (check specific-checks) + (when (stringp check) + (setq spam-split-group-choice check) + (setq specific-checks (delq check specific-checks)))) + + (let ((spam-split-group spam-split-group-choice)) + (save-excursion + (save-restriction + (dolist (check spam-list-of-statistical-checks) + (when (and (symbolp check) (symbol-value check)) + (widen) + (gnus-message 8 "spam-split: widening the buffer (%s requires it)" + (symbol-name check)) + (return))) + ;; (progn (widen) (debug (buffer-string))) + (let ((list-of-checks spam-list-of-checks) + decision) + (while (and list-of-checks (not decision)) + (let ((pair (pop list-of-checks))) + (when (and (symbol-value (car pair)) + (or (null specific-checks) + (memq (car pair) specific-checks))) + (gnus-message 5 "spam-split: calling the %s function" + (symbol-name (cdr pair))) + (setq decision (funcall (cdr pair)))))) + (if (eq decision t) + nil + decision))))))) (defun spam-setup-widening () (dolist (check spam-list-of-statistical-checks) -- 2.25.1