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))))