From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/55150 Path: main.gmane.org!not-for-mail From: lorentey@elte.hu (=?iso-8859-2?q?L=F5rentey_K=E1roly?=) Newsgroups: gmane.emacs.gnus.general Subject: Re: spam.el: automatically resplitting ham in a spam group? Date: Tue, 09 Dec 2003 03:02:18 +0100 Sender: ding-owner@lists.math.uh.edu Message-ID: References: <4nfzgkdqzx.fsf@lockgroove.bwh.harvard.edu> <4nptfnjhbb.fsf@lockgroove.bwh.harvard.edu> <4ny8ubyppq.fsf@lockgroove.bwh.harvard.edu> <4nbrr3skqt.fsf@lockgroove.bwh.harvard.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1070935373 22650 80.91.224.253 (9 Dec 2003 02:02:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 9 Dec 2003 02:02:53 +0000 (UTC) Original-X-From: ding-owner+M3690@lists.math.uh.edu Tue Dec 09 03:02:50 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ATXD7-0001g8-00 for ; Tue, 09 Dec 2003 03:02:50 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1ATXCx-0007cq-00; Mon, 08 Dec 2003 20:02:39 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1ATXCo-0007ck-00 for ding@lists.math.uh.edu; Mon, 08 Dec 2003 20:02:30 -0600 Original-Received: from eris.elte.hu (line-122-2.gprs.westel900.net [212.51.122.2]) by justine.libertine.org (Postfix) with ESMTP id 8F9D93A003A for ; Mon, 8 Dec 2003 20:02:24 -0600 (CST) Original-Received: by eris.elte.hu (Postfix, from userid 1000) id 2FB057F82E; Tue, 9 Dec 2003 03:02:18 +0100 (CET) Original-To: ding@gnus.org User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:55150 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:55150 --=-=-= Sorry it took me so long to get back to this. Ted Zlatanov 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: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=spam-hack.patch Content-Description: Optionally disable spam-split during ham respool. 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 --=-=-= Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: quoted-printable --=20 K=E1roly --=-=-=--