(spam-split): added the option of specifying a string as a
authorTeodor Zlatanov <tzz@lifelogs.com>
Mon, 27 Oct 2003 18:51:51 +0000 (18:51 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Mon, 27 Oct 2003 18:51:51 +0000 (18:51 +0000)
spam-split parameter; such a string will override
spam-split-group temporarily.

lisp/ChangeLog
lisp/spam.el

index bb901d8..63f4e4c 100644 (file)
@@ -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?
index 121965e..3fa4fb6 100644 (file)
@@ -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)