From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/73593 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.gnus.general Subject: Re: SPAM in spam group is processed into that exact same group Date: Mon, 25 Oct 2010 13:53:22 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87iq0q3xzx.fsf@lifelogs.com> References: <87ocan4cis.fsf@thinkpad.tsdh.de> <87tykbj4of.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1288032833 9103 80.91.229.12 (25 Oct 2010 18:53:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 25 Oct 2010 18:53:53 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M21962@lists.math.uh.edu Mon Oct 25 20:53:51 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PASB3-0003a7-Uj for ding-account@gmane.org; Mon, 25 Oct 2010 20:53:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1PASAq-0007wS-VS; Mon, 25 Oct 2010 13:53:37 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1PASAp-0007wD-3e for ding@lists.math.uh.edu; Mon, 25 Oct 2010 13:53:35 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PASAn-0006Iy-NB for ding@lists.math.uh.edu; Mon, 25 Oct 2010 13:53:34 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1PASAm-0006mg-00 for ; Mon, 25 Oct 2010 20:53:32 +0200 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PASAl-0003Vj-VO for ding@gnus.org; Mon, 25 Oct 2010 20:53:31 +0200 Original-Received: from 38.98.147.130 ([38.98.147.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 25 Oct 2010 20:53:31 +0200 Original-Received: from tzz by 38.98.147.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 25 Oct 2010 20:53:31 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 163 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.130 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6;d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:6t+iuSXhDHYFA2u1u84c03ktS00= X-Spam-Score: -0.7 (/) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:73593 Archived-At: --=-=-= Content-Type: text/plain On Sun, 24 Oct 2010 11:55:28 +0200 Tassilo Horn wrote: TH> Tassilo Horn writes: >> (setq gnus-spam-newsgroup-contents >> ;; My spam groups all have spam or Junk in their name >> '(("\\.\\(spam\\|Junk\\)" gnus-group-spam-classification-spam)) >> >> ;; Move SPAM in normal groups to spam training or spam group. >> gnus-spam-process-destinations >> '(("nnimap\\+Fastmail:" >> "nnimap+Fastmail:INBOX.training.spam") >> ("nnimap\\+Uni:" >> "nnimap+Uni:Junk")) >> >> ;; Move ham in spam groups to inbox and training.ham. >> gnus-ham-process-destinations >> '(("nnimap\\+Fastmail:INBOX\\.Junk Mail" >> "nnimap+Fastmail:INBOX" >> "nnimap+Fastmail:INBOX.training.ham"))) >> >> I think the processing basically works fine except one really annoying >> issue: as soon as I leave some spam group like >> >> nnimap+Fastmail:INBOX.Junk Mail >> nnimap+Fastmail:INBOX.training.spam >> nnimap+Uni:Junk >> >> which all contain only messages marked as spam ($), all messages in the >> summary buffer are moved from that group into the exact same group. TH> No, that was not true. All spam-marked messages are moved to TH> nnimap+Fastmail:INBOX.training.spam. TH> Anyway, the question is still: how do I tell Gnus to run only the ham TH> processor and not the spam processor in spam groups? You're classifying "nnimap+Fastmail:INBOX.training.spam" as a spam group and also telling spam.el to move spam messages there. So yes, it will always respool messages on exit. I think the proper fix is to make the spam exit processor check if the destination group is the same. Can you try the attached patch? Ted --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=nosamegroup.spam.patch diff --git a/lisp/spam.el b/lisp/spam.el index 097299f..2dc1fac 100644 --- a/lisp/spam.el +++ b/lisp/spam.el @@ -1440,53 +1440,58 @@ addition to the set values for the group." ;; now do the actual move (dolist (group groups) - (when (and articles (stringp group)) - ;; first, mark the article with the process mark and, if needed, - ;; the unread or expired mark (for ham and spam respectively) - (dolist (article articles) - (when (and (eq classification 'ham) - spam-mark-ham-unread-before-move-from-spam-group) - (gnus-message 9 "Marking ham article %d unread before move" - article) - (gnus-summary-mark-article article gnus-unread-mark)) - (when (and (eq classification 'spam) - (not copy)) - (gnus-message 9 "Marking spam article %d expirable before move" - article) - (gnus-summary-mark-article article gnus-expirable-mark)) - (gnus-summary-set-process-mark article) - - (if respool ; respooling is with a "fake" group - (let ((spam-split-disabled - (or spam-split-disabled - (and (eq classification 'ham) - spam-disable-spam-split-during-ham-respool)))) - (gnus-message 9 "Respooling article %d with method %s" - article respool-method) - (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 - (gnus-message 9 "Copying article %d to group %s" - article group) - (gnus-summary-copy-article nil group) - (setq deletep t)) - (gnus-message 9 "Moving article %d to group %s" - article group) - (gnus-summary-move-article nil group))))) ; else move articles - - ;; now delete the articles, unless a) copy is t, and there was a copy done - ;; b) a move was done to a single group - ;; c) backend-supports-deletions is nil - (unless copy - (when (and deletep backend-supports-deletions) - (dolist (article articles) - (gnus-summary-set-process-mark article) - (gnus-message 9 "Deleting article %d" article)) - (when articles - (let ((gnus-novice-user nil)) ; don't ask me if I'm sure - (gnus-summary-delete-article nil))))) + (if (equal group gnus-newsgroup-name) + (gnus-message 1 "Skipping spam move to same group %s" group) + (when (and articles (stringp group)) + + ;; first, mark the article with the process mark and, if needed, + ;; the unread or expired mark (for ham and spam respectively) + (dolist (article articles) + (when (and (eq classification 'ham) + spam-mark-ham-unread-before-move-from-spam-group) + (gnus-message 9 "Marking ham article %d unread before move" + article) + (gnus-summary-mark-article article gnus-unread-mark)) + (when (and (eq classification 'spam) + (not copy)) + (gnus-message 9 "Marking spam article %d expirable before move" + article) + (gnus-summary-mark-article article gnus-expirable-mark)) + (gnus-summary-set-process-mark article) + + (if respool ; respooling is with a "fake" group + (let ((spam-split-disabled + (or spam-split-disabled + (and (eq classification 'ham) + spam-disable-spam-split-during-ham-respool)))) + (gnus-message 9 "Respooling article %d with method %s" + article respool-method) + (gnus-summary-respool-article nil respool-method)) + ;; else, we are not respooling + (if (or (not backend-supports-deletions) + (> (length groups) 1)) + (progn ; if copying, copy and set deletep + (gnus-message 9 "Copying article %d to group %s" + article group) + (gnus-summary-copy-article nil group) + (setq deletep t)) + ;; else move articles + (gnus-message 9 "Moving article %d to group %s" + article group) + (gnus-summary-move-article nil group))))) + + ;; now delete the articles, unless a) copy is t, and a copy was done + ;; b) a move was done to a single group + ;; c) backend-supports-deletions is nil + (unless copy + (when (and deletep backend-supports-deletions) + (dolist (article articles) + (gnus-summary-set-process-mark article) + (gnus-message 9 "Deleting article %d" article)) + (when articles + (let ((gnus-novice-user nil)) ; don't ask me if I'm sure + (gnus-summary-delete-article nil)))))) (gnus-summary-yank-process-mark) (length articles)))) --=-=-=--