Obsolete local list functions in shadowfile.el

* lisp/shadowfile.el (shadow-union): Make obsolete in favour of
cl-union.  Update callers.
(shadow-find): Make into obsolete function alias for seq-find.
Update callers.
(cl-lib): Remove unnecessary require.
This commit is contained in:
Stefan Kangas 2021-04-05 14:17:02 +02:00
parent 6060d53b3e
commit 257caab1d0

View file

@ -73,7 +73,6 @@
;;; Code:
(require 'cl-lib)
(require 'tramp)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -172,20 +171,6 @@ created by `shadow-define-regexp-group'.")
;;; Syntactic sugar; General list and string manipulation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun shadow-union (a b)
"Add members of list A to list B if not equal to items already in B."
(if (null a)
b
(if (member (car a) b)
(shadow-union (cdr a) b)
(shadow-union (cdr a) (cons (car a) b)))))
(defun shadow-find (func list)
"If FUNC applied to some element of LIST is non-nil, return first such element."
(while (and list (not (funcall func (car list))))
(setq list (cdr list)))
(car list))
(defun shadow-regexp-superquote (string)
"Like `regexp-quote', but includes the \\` and \\'.
This makes sure regexp matches nothing but STRING."
@ -226,7 +211,7 @@ information defining the cluster. For interactive use, call
(defun shadow-get-cluster (name)
"Return cluster named NAME, or nil."
(shadow-find
(seq-find
(lambda (x) (string-equal (shadow-cluster-name x) name))
shadow-clusters))
@ -252,7 +237,7 @@ information defining the cluster. For interactive use, call
(defun shadow-site-cluster (site)
"Given a SITE, return cluster it is in, or nil."
(or (shadow-get-cluster (shadow-site-name site))
(shadow-find
(seq-find
(lambda (x)
(string-match (shadow-cluster-regexp x) (shadow-name-site site)))
shadow-clusters)))
@ -653,7 +638,7 @@ Consider them as regular expressions if third arg REGEXP is true."
shadows shadow-files-to-copy (with-output-to-string (backtrace))))
(when shadows
(setq shadow-files-to-copy
(shadow-union shadows shadow-files-to-copy))
(cl-union shadows shadow-files-to-copy :test #'equal))
(when (not shadow-inhibit-message)
(message "%s" (substitute-command-keys
"Use \\[shadow-copy-files] to update shadows."))
@ -839,6 +824,17 @@ look for files that have been changed and need to be copied to other systems."
;; continue standard unloading
nil)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Obsolete
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun shadow-union (a b)
"Add members of list A to list B if not equal to items already in B."
(declare (obsolete cl-union "28.1"))
(cl-union a b :test #'equal))
(define-obsolete-function-alias 'shadow-find #'seq-find "28.1")
(provide 'shadowfile)
;;; shadowfile.el ends here