From: Ted Zlatanov <tzz@lifelogs.com>
To: ding@gnus.org
Subject: Re: SPAM in spam group is processed into that exact same group
Date: Mon, 25 Oct 2010 13:53:22 -0500 [thread overview]
Message-ID: <87iq0q3xzx.fsf@lifelogs.com> (raw)
In-Reply-To: <87tykbj4of.fsf@thinkpad.tsdh.de>
[-- Attachment #1: Type: text/plain, Size: 1653 bytes --]
On Sun, 24 Oct 2010 11:55:28 +0200 Tassilo Horn <tassilo@member.fsf.org> wrote:
TH> Tassilo Horn <tassilo@member.fsf.org> 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nosamegroup.spam.patch --]
[-- Type: text/x-diff, Size: 5162 bytes --]
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))))
next prev parent reply other threads:[~2010-10-25 18:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-21 18:38 Tassilo Horn
2010-10-24 9:55 ` Tassilo Horn
2010-10-25 18:53 ` Ted Zlatanov [this message]
2010-10-25 20:05 ` Tassilo Horn
2010-10-25 20:23 ` Ted Zlatanov
2010-10-26 7:04 ` Tassilo Horn
2010-10-26 16:26 ` Ted Zlatanov
2010-10-26 17:38 ` Tassilo Horn
2010-10-26 18:47 ` Ted Zlatanov
2010-10-26 21:04 ` Tassilo Horn
2010-10-27 17:37 ` Ted Zlatanov
2010-11-03 16:39 ` Tassilo Horn
2010-11-04 8:16 ` Tassilo Horn
2010-11-04 20:18 ` Lars Magne Ingebrigtsen
2010-11-05 8:59 ` Tassilo Horn
2010-11-30 16:58 ` Tassilo Horn
2010-11-30 18:36 ` Tassilo Horn
2010-12-05 12:33 ` Lars Magne Ingebrigtsen
2010-12-05 18:13 ` Tassilo Horn
2010-12-05 18:37 ` Lars Magne Ingebrigtsen
2010-12-14 22:32 ` Ted Zlatanov
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=87iq0q3xzx.fsf@lifelogs.com \
--to=tzz@lifelogs.com \
--cc=ding@gnus.org \
/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).