(spam-mark-spam-as-expired-and-move-routine)
authorTeodor Zlatanov <tzz@lifelogs.com>
Mon, 27 Oct 2003 16:08:46 +0000 (16:08 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Mon, 27 Oct 2003 16:08:46 +0000 (16:08 +0000)
(spam-ham-copy-or-move-routine): don't ask when deleting copied
articles, and use move instead of copy when possible

lisp/ChangeLog
lisp/spam.el

index 922c4b1..bb901d8 100644 (file)
@@ -1,5 +1,9 @@
 2003-10-27  Teodor Zlatanov  <tzz@lifelogs.com>
 
+       * spam.el (spam-mark-spam-as-expired-and-move-routine)
+       (spam-ham-copy-or-move-routine): don't ask when deleting copied
+       articles, and use move instead of copy when possible
+
        * nnmail.el (nnmail-cache-insert): protect from nil message IDs,
        but should we do something else?
 
index 9a4ea25..121965e 100644 (file)
@@ -551,7 +551,7 @@ spamoracle database."
 (defun spam-mark-spam-as-expired-and-move-routine (&rest groups)
   (gnus-summary-kill-process-mark)
   (let ((articles gnus-newsgroup-articles)
-       article tomove todelete)
+       article tomove deletep)
     (dolist (article articles)
       (when (eq (gnus-summary-article-mark article) gnus-spam-mark)
        (gnus-summary-mark-article article gnus-expirable-mark)
@@ -564,22 +564,26 @@ spamoracle database."
        (dolist (article tomove)
          (gnus-summary-set-process-mark article))
        (when tomove
-         (gnus-summary-copy-article nil group)
-         (setq todelete t))))
+         (if (> (length groups) 1)
+             (progn 
+               (gnus-summary-copy-article nil group)
+               (setq deletep t))
+           (gnus-summary-move-article nil group)))))
     
     ;; now delete the articles, if there was a copy done
-    (when todelete
+    (when deletep
       (dolist (article tomove)
        (gnus-summary-set-process-mark article))
       (when tomove
-       (gnus-summary-delete-article nil)))
+       (let ((gnus-novice-user nil))   ; don't ask me if I'm sure
+         (gnus-summary-delete-article nil))))
     
     (gnus-summary-yank-process-mark)))
  
 (defun spam-ham-copy-or-move-routine (copy groups)
   (gnus-summary-kill-process-mark)
   (let ((articles gnus-newsgroup-articles)
-       article mark todo todelete)
+       article mark todo deletep)
     (dolist (article articles)
       (when (spam-group-ham-mark-p gnus-newsgroup-name
                                   (gnus-summary-article-mark article))
@@ -592,16 +596,22 @@ spamoracle database."
          (when spam-mark-ham-unread-before-move-from-spam-group
            (gnus-summary-mark-article article gnus-unread-mark))
          (gnus-summary-set-process-mark article))
-       (gnus-summary-copy-article nil group)
-       (setq todelete t)))
+
+       (if (> (length groups) 1)
+           (progn 
+             (gnus-summary-copy-article nil group)
+             (setq deletep t))
+         (gnus-summary-move-article nil group))))
   
-    ;; now delete the articles, unless copy is t, and when there was a copy done
+    ;; now delete the articles, unless a) copy is t, and when there was a copy done
+    ;;                                 b) a move was done to a single group
     (unless copy
-      (when todelete
+      (when deletep
        (dolist (article todo)
          (gnus-summary-set-process-mark article))
        (when todo
-         (gnus-summary-delete-article nil)))))
+         (let ((gnus-novice-user nil)) ; don't ask me if I'm sure
+           (gnus-summary-delete-article nil))))))
   
   (gnus-summary-yank-process-mark))