Gnus development mailing list
 help / color / mirror / Atom feed
From: lorentey@elte.hu (Lőrentey Károly)
Subject: Re: spam.el: automatically resplitting ham in a spam group?
Date: Tue, 09 Dec 2003 03:02:18 +0100	[thread overview]
Message-ID: <lorentey.l.ding.87llpmoij9.elte@eris.elte.hu> (raw)
In-Reply-To: <4nbrr3skqt.fsf@lockgroove.bwh.harvard.edu>

[-- Attachment #1: Type: text/plain, Size: 531 bytes --]

Sorry it took me so long to get back to this.

Ted Zlatanov <tzz@lifelogs.com> writes:
>> If you're interested, here is my change: (it's quite ugly, but
>> works)
>
> I didn't see this until I had done quite a bit of work on spam.el
> in a different direction, so I'm afraid your patch won't work
> cleanly.  Can you check your patch against the mega-patch I'll be
> posting later tonight and see if there are any conflicts?  Thanks!

By all means!  It seems there were no conflicts.  Here is a new patch
against the current CVS:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Optionally disable spam-split during ham respool. --]
[-- Type: text/x-patch, Size: 4313 bytes --]

Index: spam.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/spam.el,v
retrieving revision 6.139
diff -u -r6.139 spam.el
--- spam.el	7 Dec 2003 15:39:13 -0000	6.139
+++ spam.el	9 Dec 2003 01:58:06 -0000
@@ -119,6 +119,15 @@
   :type 'boolean
   :group 'spam)
 
+(defcustom spam-disable-spam-split-during-ham-respool nil
+  "Whether spam-split should be ignored while resplitting ham in
+a process destination.  This is useful to prevent ham from ending
+up in the same spam group after the resplit.  Don't set this to t
+if you have spam-split as the last rule in your split
+configuration."
+  :type 'boolean
+  :group 'spam)
+
 (defcustom spam-whitelist (expand-file-name "whitelist" spam-directory)
   "The location of the whitelist.
 The file format is one regular expression per line.
@@ -696,8 +705,11 @@
 	    (gnus-summary-mark-article article gnus-unread-mark))
 	  (gnus-summary-set-process-mark article))
 
-	(if respool		   ; respooling is with a "fake" group
-	    (gnus-summary-respool-article nil respool-method)
+	(if respool			   ; respooling is with a "fake" group
+	    (let ((spam-split-disabled
+		   (or spam-split-disabled
+		       spam-disable-spam-split-during-ham-respool)))
+	      (gnus-summary-respool-article nil respool-method))
 	  (if (or (not backend-supports-deletions) ; else, we are not respooling
 		  (> (length groups) 1))
 	      (progn		    ; if copying, copy and set deletep
@@ -826,6 +838,9 @@
   "The spam-list-of-statistical-checks list contains all the mail
 splitters that need to have the full message body available.")
 
+(defvar spam-split-disabled nil
+  "If non-nil, spam-split is disabled, and always returns nil.")
+
 ;;;TODO: modify to invoke self with each check if invoked without specifics
 (defun spam-split (&rest specific-checks)
   "Split this message into the `spam' group if it is spam.
@@ -836,35 +851,36 @@
 
 See the Info node `(gnus)Fancy Mail Splitting' for more details."
   (interactive)
-  (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)))))))
+  (unless spam-split-disabled
+    (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))))))))
 
 (defvar spam-registration-functions
   ;; first the ham register, second the spam register function

[-- Attachment #3: Type: text/plain, Size: 15 bytes --]


-- 
Károly

  reply	other threads:[~2003-12-09  2:02 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-19 15:14 Lőrentey Károly
2003-11-19 20:48 ` Ted Zlatanov
2003-11-19 20:57   ` Jody Klymak
2003-11-19 21:24     ` Ted Zlatanov
2003-11-19 21:48     ` Reiner Steib
2003-11-19 21:58       ` Jody Klymak
2003-11-20 11:17         ` Ted Zlatanov
2003-11-20 14:46           ` Jake Colman
2003-11-20 12:19   ` Lőrentey Károly
2003-11-20 12:48     ` Lőrentey Károly
2003-11-20 13:33       ` Ted Zlatanov
2003-11-20 15:48         ` Lőrentey Károly
2003-11-20 16:22           ` Ted Zlatanov
2003-11-20 18:20             ` Lőrentey Károly
2003-11-23  5:43               ` Ted Zlatanov
2003-12-09  2:02                 ` Lőrentey Károly [this message]
2003-12-09 22:20                   ` Ted Zlatanov
2003-12-09 22:57                     ` Lőrentey Károly
2003-12-10 19:57                       ` Ted Zlatanov
2003-11-20 13:28     ` Ted Zlatanov
2003-11-20 18:42       ` Lőrentey Károly
2003-11-19 21:51 ` Kai Grossjohann
2003-11-19 21:53   ` Kai Grossjohann
2003-11-19 22:05     ` Josh Huber
2003-11-20 20:30       ` Kai Grossjohann
2003-11-20 21:07         ` Josh Huber
2003-11-20 14:48     ` Jake Colman
2003-11-20 11:22   ` Ted Zlatanov
2003-11-20 12:31     ` Lőrentey Károly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lorentey.l.ding.87llpmoij9.elte@eris.elte.hu \
    --to=lorentey@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).