From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/54892 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: Thu, 20 Nov 2003 19:20:20 +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> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1069352443 31897 80.91.224.253 (20 Nov 2003 18:20:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 20 Nov 2003 18:20:43 +0000 (UTC) Original-X-From: ding-owner+M3432@lists.math.uh.edu Thu Nov 20 19:20:39 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 1AMtPz-0003nv-00 for ; Thu, 20 Nov 2003 19:20:39 +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 1AMtPp-0002oV-00; Thu, 20 Nov 2003 12:20:29 -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 1AMtPj-0002oQ-00 for ding@lists.math.uh.edu; Thu, 20 Nov 2003 12:20:23 -0600 Original-Received: from eris.elte.hu (eris.elte.hu [157.181.150.146]) by justine.libertine.org (Postfix) with ESMTP id 8209F3A0025 for ; Thu, 20 Nov 2003 12:20:22 -0600 (CST) Original-Received: by eris.elte.hu (Postfix, from userid 1000) id 5CCC87F816; Thu, 20 Nov 2003 19:20:20 +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:54892 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:54892 --=-=-= Ted Zlatanov writes: > On Thu, 20 Nov 2003, lorentey@elte.hu wrote: > >> I see. But I don't think it is normal that spam-split (or some >> other nil-returning function) would be at the end of the split >> specification. > > That's never stopped anyone :) You are right, of course. :-) > Let me give you an example: gnus-use-ifile is guaranteed to return a > group name. So the user makes spam-split the last entry in the > split rules. Eventually the user decides to turn spam-use-ifile > off. It's not a farfetched scenario at all. But if I understand it well, no message would be lost; they would just reappear in the current group, and I think these users can easily fix their configuration, or simply ignore the new respooling feature. Adding a note to the documentation along the lines of 'to prevent unexpected results, if you plan to use this feature, make sure that your split rules are set up so that the last rule never returns nil' would be enough, I guess. (By the way: is it 'respool' or 'resplit'? I don't know the correct terminology.) >> IMHO most of this (except infrequent the nil case) would be >> eliminated by disabling spam-split. > > Well, try it with the current respool behavior and let's see how it > works. It may be that all this worrying was unnecessary. Thank you for implementing this! I appreciate your work. I have played with it for a while, and after adding the no-spam-split-during-respool thingy, I think it does exactly what I need. If you're interested, here is my change: (it's quite ugly, but works) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=spam.respool.patch Content-Description: spam.el diff Index: spam.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/spam.el,v retrieving revision 6.133 diff -u -r6.133 spam.el --- spam.el 20 Nov 2003 14:52:28 -0000 6.133 +++ spam.el 20 Nov 2003 18:16:33 -0000 @@ -116,6 +116,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 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. @@ -623,7 +632,8 @@ (gnus-summary-set-process-mark article)) (if respool ; respooling is with a "fake" group - (gnus-summary-respool-article nil respool-method) + (let ((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 @@ -763,6 +773,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 specific check if invoked without specific checks (defun spam-split (&rest specific-checks) "Split this message into the `spam' group if it is spam. @@ -773,35 +786,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)))))))) ;;; log a ham- or spam-processor invocation to the registry (defun spam-log-processing-to-registry (id type classification check group) --=-=-= Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: quoted-printable --=20 K=E1roly --=-=-=--