summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-range.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/gnus-range.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/gnus-range.el')
-rw-r--r--lisp/gnus/gnus-range.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/gnus/gnus-range.el b/lisp/gnus/gnus-range.el
index 7d12ae9fdcc..456209f3d9a 100644
--- a/lisp/gnus/gnus-range.el
+++ b/lisp/gnus/gnus-range.el
@@ -42,8 +42,13 @@ If RANGE is a single range, return (RANGE). Otherwise, return RANGE."
(defun gnus-set-difference (list1 list2)
"Return a list of elements of LIST1 that do not appear in LIST2."
- (declare (obsolete seq-difference "28.1"))
- (seq-difference list1 list2 #'eq))
+ (let ((hash2 (make-hash-table :test 'eq))
+ (result nil))
+ (dolist (elt list2) (puthash elt t hash2))
+ (dolist (elt list1)
+ (unless (gethash elt hash2)
+ (setq result (cons elt result))))
+ (nreverse result)))
(defun gnus-range-nconcat (&rest ranges)
"Return a range comprising all the RANGES, which are pre-sorted.