summaryrefslogtreecommitdiff
path: root/lisp/gnus/spam.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-09-29 17:25:01 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-09-29 17:28:02 +0200
commitb4b4cc98ac271d079916a4c412e134fe5b4ba4d8 (patch)
treeb512da9839cf37fa37322df806406de4297dcc31 /lisp/gnus/spam.el
parente457cff3f48b6fc3fe9efc30b9896181c59011da (diff)
downloademacs-b4b4cc98ac271d079916a4c412e134fe5b4ba4d8.tar.gz
emacs-b4b4cc98ac271d079916a4c412e134fe5b4ba4d8.tar.bz2
emacs-b4b4cc98ac271d079916a4c412e134fe5b4ba4d8.zip
Revert "Obsolete local set difference functions in favor of seq-difference"
This reverts commit 20f7fa691b7c2859b96550d9ccb326bf394e160d. gnus-set-difference is orders of magnitude faster than seq-difference (on these sets), and using seq-difference makes nnimap too slow.
Diffstat (limited to 'lisp/gnus/spam.el')
-rw-r--r--lisp/gnus/spam.el14
1 files changed, 11 insertions, 3 deletions
diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el
index 3f978918b9a..d00f0a60b66 100644
--- a/lisp/gnus/spam.el
+++ b/lisp/gnus/spam.el
@@ -710,8 +710,16 @@ finds ham or spam.")
(defun spam-set-difference (list1 list2)
"Return a set difference of LIST1 and LIST2.
When either list is nil, the other is returned."
- (declare (obsolete seq-difference "28.1"))
- (seq-difference list1 list2 #'eq))
+ (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-group-ham-mark-p (group mark &optional spam)
"Checks if MARK is considered a ham mark in GROUP."
@@ -1319,7 +1327,7 @@ In the case of mover backends, checks the setting of
(new-articles (spam-list-articles
gnus-newsgroup-articles
classification))
- (changed-articles (seq-difference new-articles old-articles #'eq)))
+ (changed-articles (spam-set-difference new-articles old-articles)))
;; now that we have the changed articles, we go through the processors
(dolist (backend (spam-backend-list))
(let (unregister-list)