From: Stefan Kangas Date: Tue, 9 Aug 2022 12:29:12 +0000 (+0200) Subject: Replace utility functions with seq-uniq X-Git-Tag: emacs-29.0.90~1447^2~281^2~7 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=171b9314bf2b2ed1719f2451b527960e0a363a40;p=emacs.git Replace utility functions with seq-uniq * lisp/gnus/gnus-util.el (gnus-delete-duplicates): * lisp/ibuf-ext.el (ibuffer-remove-duplicates): Redefine as obsolete function alias for 'seq-uniq'. Update callers. --- diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 880192e3bb9..d1ad5bd7b2d 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -750,15 +750,6 @@ nil. See also `gnus-bind-print-variables'." (when (file-exists-p file) (delete-file file))) -(defun gnus-delete-duplicates (list) - "Remove duplicate entries from LIST." - (let ((result nil)) - (while list - (unless (member (car list) result) - (push (car list) result)) - (pop list)) - (nreverse result))) - (defun gnus-delete-directory (directory) "Delete files in DIRECTORY. Subdirectories remain. If there's no subdirectory, delete DIRECTORY as well." @@ -1550,6 +1541,8 @@ lists of strings." ;; gnus-util. (autoload 'gnus-output-to-rmail "gnus-rmail") +(define-obsolete-function-alias 'gnus-delete-duplicates #'seq-uniq "29.1") + (provide 'gnus-util) ;;; gnus-util.el ends here diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 17bbfda08f4..73cd183a02a 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -555,7 +555,7 @@ during splitting, which may be slow." ;; Look for the credentials based on ;; the virtual server name and the address (nnimap-credentials - (gnus-delete-duplicates + (seq-uniq (list server nnimap-address)) ports nnimap-user)))) diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index 951978fc5b1..3dc74c95fb3 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -99,7 +99,7 @@ SUFFIX should start with \":2,\"." (let* ((flags (substring suffix 3)) (flags-as-list (append flags nil)) (new-flags - (concat (gnus-delete-duplicates + (concat (seq-uniq ;; maildir flags must be sorted (sort (cons flag flags-as-list) #'<))))) (concat ":2," new-flags))) @@ -1015,7 +1015,7 @@ This variable is set by `nnmaildir-request-article'.") dir (nnmaildir--nndir dir) dir (nnmaildir--marks-dir dir) ls (nnmaildir--group-ls nnmaildir--cur-server pgname) - all-marks (gnus-delete-duplicates + all-marks (seq-uniq ;; get mark names from mark dirs and from flag ;; mappings (append @@ -1697,7 +1697,7 @@ This variable is set by `nnmaildir-request-article'.") pgname (nnmaildir--pgname nnmaildir--cur-server gname) ls (nnmaildir--group-ls nnmaildir--cur-server pgname) all-marks (funcall ls marksdir nil "\\`[^.]" 'nosort) - all-marks (gnus-delete-duplicates + all-marks (seq-uniq ;; get mark names from mark dirs and from flag ;; mappings (append diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 621e648a2dd..a56c1a87212 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -52,17 +52,6 @@ (setq alist (remove it alist)) it)) alist) -;; borrowed from Gnus -(defun ibuffer-remove-duplicates (list) - "Return a copy of LIST with duplicate elements removed." - (let ((new nil) - (tail list)) - (while tail - (or (member (car tail) new) - (setq new (cons (car tail) new))) - (setq tail (cdr tail))) - (nreverse new))) - (defun ibuffer-split-list (fn elts) (declare (obsolete seq-group-by "29.1")) (let ((res (seq-group-by fn elts))) @@ -799,7 +788,7 @@ specification, with the same structure as an element of the list (mapcar (lambda (mode) (cons (format "%s" mode) `((mode . ,mode)))) (let ((modes - (ibuffer-remove-duplicates + (seq-uniq (mapcar (lambda (buf) (buffer-local-value 'major-mode buf)) (buffer-list))))) @@ -1986,6 +1975,8 @@ defaults to one." (push buf ibuffer-do-occur-bufs))) (occur-1 regexp nlines ibuffer-do-occur-bufs))) +(define-obsolete-function-alias 'ibuffer-remove-duplicates #'seq-uniq "29.1") + (provide 'ibuf-ext) ;; Local Variables: