]> git.eshelyaron.com Git - emacs.git/commitdiff
Obsolete local list functions in shadowfile.el
authorStefan Kangas <stefan@marxist.se>
Mon, 5 Apr 2021 12:17:02 +0000 (14:17 +0200)
committerStefan Kangas <stefan@marxist.se>
Mon, 5 Apr 2021 12:18:24 +0000 (14:18 +0200)
* 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.

lisp/shadowfile.el

index a4f0eba4449a676ffe83f194308f4022b084346b..7fe3ed2f9bd34dc8fa60ae2e9a488d720a5f4117 100644 (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