]> git.eshelyaron.com Git - emacs.git/commitdiff
Obsolete local set difference functions in favor of seq-difference
authorStefan Kangas <stefan@marxist.se>
Mon, 5 Apr 2021 12:24:00 +0000 (14:24 +0200)
committerStefan Kangas <stefan@marxist.se>
Mon, 5 Apr 2021 12:24:00 +0000 (14:24 +0200)
* lisp/emacs-lisp/seq.el (seq-difference): Add autoload cookie.
* lisp/gnus/gnus-range.el (gnus-set-difference):
* lisp/gnus/spam.el (spam-set-difference): Make obsolete in favor
of seq-difference.  Update callers.

lisp/emacs-lisp/seq.el
lisp/gnus/gnus-cite.el
lisp/gnus/gnus-range.el
lisp/gnus/gnus-sum.el
lisp/gnus/gnus-uu.el
lisp/gnus/nnimap.el
lisp/gnus/spam.el

index f2f7d677e88bab825da916d244152155da15e3fd..7aa5684cfd19e1c79080100038d77ff0013a0074 100644 (file)
@@ -468,6 +468,7 @@ Equality is defined by TESTFN if non-nil or by `equal' if nil."
               (seq-reverse sequence1)
               '()))
 
+;;;###autoload
 (cl-defgeneric seq-difference (sequence1 sequence2 &optional testfn)
   "Return a list of the elements that appear in SEQUENCE1 but not in SEQUENCE2.
 Equality is defined by TESTFN if non-nil or by `equal' if nil."
index 1f564f192b0fa79dcd7aa0894edbad26817e854e..4249b50b9ffa4d0f901304aaa256daeb75e35511 100644 (file)
@@ -839,7 +839,7 @@ See also the documentation for `gnus-article-highlight-citation'."
                 (setq current (car loop)
                       loop (cdr loop))
                 (setcdr current
-                        (gnus-set-difference (cdr current) numbers)))))))))
+                         (seq-difference (cdr current) numbers #'eq)))))))))
 
 (defun gnus-cite-parse-attributions ()
   (let (al-alist)
@@ -999,7 +999,7 @@ See also the documentation for `gnus-article-highlight-citation'."
                    loop (cdr loop))
              (if (eq current best)
                  ()
-               (setcdr current (gnus-set-difference (cdr current) numbers))
+                (setcdr current (seq-difference (cdr current) numbers #'eq))
                (when (null (cdr current))
                  (setq gnus-cite-loose-prefix-alist
                        (delq current gnus-cite-loose-prefix-alist)
index 456209f3d9ada63ed609b77df1491d339946a2f1..7d12ae9fdcc0f8b81c5e53a72ea449d2c21d74ed 100644 (file)
@@ -42,13 +42,8 @@ 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."
-  (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)))
+  (declare (obsolete seq-difference "28.1"))
+  (seq-difference list1 list2 #'eq))
 
 (defun gnus-range-nconcat (&rest ranges)
   "Return a range comprising all the RANGES, which are pre-sorted.
index ac9317ef4e2750d96ee46db5fd3e72f28b4dfa21..eeb5ac851ae5bd2a369068d3af22c943fa74e98a 100644 (file)
@@ -8569,8 +8569,9 @@ If UNREPLIED (the prefix), limit to unreplied articles."
   (interactive "P" gnus-summary-mode)
   (if unreplied
       (gnus-summary-limit
-       (gnus-set-difference gnus-newsgroup-articles
-       gnus-newsgroup-replied))
+       (seq-difference gnus-newsgroup-articles
+                       gnus-newsgroup-replied
+                       #'eq))
     (gnus-summary-limit gnus-newsgroup-replied))
   (gnus-summary-position-point))
 
index 5cbe8495d31c4664ca3e4a3ea254818c10d0dea0..ceb2ebcdcb16aa22e7531d82dcf9cb38d3e7230b 100644 (file)
@@ -579,7 +579,7 @@ didn't work, and overwrite existing files.  Otherwise, ask each time."
 (defun gnus-new-processable (unmarkp articles)
   (if unmarkp
       (nreverse (seq-intersection gnus-newsgroup-processable articles #'eq))
-    (gnus-set-difference articles gnus-newsgroup-processable)))
+    (seq-difference articles gnus-newsgroup-processable #'eq)))
 
 (defun gnus-uu-mark-by-regexp (regexp &optional unmark)
   "Set the process mark on articles whose subjects match REGEXP.
index f06959f65d994015e8f53b6d4dd771754780ddfd..8990b2bebeb95b7eebe378573bb9f7d47d9283e8 100644 (file)
@@ -1614,13 +1614,15 @@ If LIMIT, first try to limit the search to the N last articles."
              (setq start-article 1))
            (let* ((unread
                    (gnus-compress-sequence
-                    (gnus-set-difference
-                     (gnus-set-difference
+                     (seq-difference
+                      (seq-difference
                       existing
                       (gnus-sorted-union
                        (cdr (assoc '%Seen flags))
-                       (cdr (assoc '%Deleted flags))))
-                     (cdr (assoc '%Flagged flags)))))
+                        (cdr (assoc '%Deleted flags)))
+                       #'eq)
+                      (cdr (assoc '%Flagged flags))
+                      #'eq)))
                   (read (gnus-range-difference
                          (cons start-article high) unread)))
              (when (> start-article 1)
index d00f0a60b66b5364e8c5eacd2e4fc74b51fca3b5..3f978918b9a5dcb6e090524e4b5b5feb65b409e8 100644 (file)
@@ -710,16 +710,8 @@ 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."
-  (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)))
+  (declare (obsolete seq-difference "28.1"))
+  (seq-difference list1 list2 #'eq))
 
 (defun spam-group-ham-mark-p (group mark &optional spam)
   "Checks if MARK is considered a ham mark in GROUP."
@@ -1327,7 +1319,7 @@ In the case of mover backends, checks the setting of
              (new-articles (spam-list-articles
                             gnus-newsgroup-articles
                             classification))
-             (changed-articles (spam-set-difference new-articles old-articles)))
+             (changed-articles (seq-difference new-articles old-articles #'eq)))
         ;; now that we have the changed articles, we go through the processors
         (dolist (backend (spam-backend-list))
           (let (unregister-list)