emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 257caab: Obsolete local list functions in shadowfile.el


From: Stefan Kangas
Subject: master 257caab: Obsolete local list functions in shadowfile.el
Date: Mon, 5 Apr 2021 08:18:32 -0400 (EDT)

branch: master
commit 257caab1d0bea17fb9bfb5a9e2c782cf96a7d052
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    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.
---
 lisp/shadowfile.el | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/lisp/shadowfile.el b/lisp/shadowfile.el
index a4f0eba..7fe3ed2 100644
--- a/lisp/shadowfile.el
+++ b/lisp/shadowfile.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]