(spam-set-difference): new function to replace
authorTeodor Zlatanov <tzz@lifelogs.com>
Fri, 2 Apr 2004 19:09:16 +0000 (19:09 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Fri, 2 Apr 2004 19:09:16 +0000 (19:09 +0000)
gnus-set-difference in spam.el
(spam-summary-prepare-exit): use spam-set-difference

lisp/ChangeLog
lisp/spam.el

index eda2149..09feac0 100644 (file)
@@ -1,3 +1,9 @@
+2004-04-02  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * spam.el (spam-set-difference): new function to replace
+       gnus-set-difference in spam.el
+       (spam-summary-prepare-exit): use spam-set-difference
+
 2004-03-29  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * gnus-registry.el (gnus-registry-cache-file): updated to use
index f2211fe..0c0a509 100644 (file)
@@ -718,7 +718,7 @@ Respects the process/prefix convention."
             (new-articles (spam-list-articles
                            gnus-newsgroup-articles
                            classification))
-            (changed-articles (gnus-set-difference new-articles old-articles)))
+            (changed-articles (spam-set-difference new-articles old-articles)))
        ;; now that we have the changed articles, we go through the processors
        (dolist (processor-param spam-list-of-processors)
          (let ((processor (nth 0 processor-param))
@@ -785,6 +785,20 @@ Respects the process/prefix convention."
   (setq spam-old-ham-articles nil)
   (setq spam-old-spam-articles nil))
 
+(defun spam-set-difference (list1 list2)
+  "Return a set difference of LIST1 and LIST2.  
+When either list is nil, the other is returned."
+  (if (and list1 list2)
+      ;; we have two non-nil lists
+      (progn
+       (dolist (item (append list1 list2))
+         (when (and (memq item list1) (memq item list2))
+           (setq list1 (delq item list1))
+           (setq list2 (delq item list2))))
+       (append list1 list2))
+    ;; if either of the lists was nil, return the other one
+    (if list1 list1 list2)))
+
 (defun spam-mark-junk-as-spam-routine ()
   ;; check the global list of group names spam-junk-mailgroups and the
   ;; group parameters