aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2021-04-05 14:17:02 +0200
committerStefan Kangas2021-04-05 14:18:24 +0200
commit257caab1d0bea17fb9bfb5a9e2c782cf96a7d052 (patch)
treea53c4f885800ee2d7432a3685fec50c601e4f302
parent6060d53b3e8aa1cdc642b477a42a7b769c676598 (diff)
downloademacs-257caab1d0bea17fb9bfb5a9e2c782cf96a7d052.tar.gz
emacs-257caab1d0bea17fb9bfb5a9e2c782cf96a7d052.zip
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.
-rw-r--r--lisp/shadowfile.el32
1 files changed, 14 insertions, 18 deletions
diff --git a/lisp/shadowfile.el b/lisp/shadowfile.el
index a4f0eba4449..7fe3ed2f9bd 100644
--- a/lisp/shadowfile.el
+++ b/lisp/shadowfile.el
@@ -73,7 +73,6 @@
73 73
74;;; Code: 74;;; Code:
75 75
76(require 'cl-lib)
77(require 'tramp) 76(require 'tramp)
78 77
79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 78;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -172,20 +171,6 @@ created by `shadow-define-regexp-group'.")
172;;; Syntactic sugar; General list and string manipulation 171;;; Syntactic sugar; General list and string manipulation
173;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 172;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
174 173
175(defun shadow-union (a b)
176 "Add members of list A to list B if not equal to items already in B."
177 (if (null a)
178 b
179 (if (member (car a) b)
180 (shadow-union (cdr a) b)
181 (shadow-union (cdr a) (cons (car a) b)))))
182
183(defun shadow-find (func list)
184 "If FUNC applied to some element of LIST is non-nil, return first such element."
185 (while (and list (not (funcall func (car list))))
186 (setq list (cdr list)))
187 (car list))
188
189(defun shadow-regexp-superquote (string) 174(defun shadow-regexp-superquote (string)
190 "Like `regexp-quote', but includes the \\` and \\'. 175 "Like `regexp-quote', but includes the \\` and \\'.
191This makes sure regexp matches nothing but STRING." 176This makes sure regexp matches nothing but STRING."
@@ -226,7 +211,7 @@ information defining the cluster. For interactive use, call
226 211
227(defun shadow-get-cluster (name) 212(defun shadow-get-cluster (name)
228 "Return cluster named NAME, or nil." 213 "Return cluster named NAME, or nil."
229 (shadow-find 214 (seq-find
230 (lambda (x) (string-equal (shadow-cluster-name x) name)) 215 (lambda (x) (string-equal (shadow-cluster-name x) name))
231 shadow-clusters)) 216 shadow-clusters))
232 217
@@ -252,7 +237,7 @@ information defining the cluster. For interactive use, call
252(defun shadow-site-cluster (site) 237(defun shadow-site-cluster (site)
253 "Given a SITE, return cluster it is in, or nil." 238 "Given a SITE, return cluster it is in, or nil."
254 (or (shadow-get-cluster (shadow-site-name site)) 239 (or (shadow-get-cluster (shadow-site-name site))
255 (shadow-find 240 (seq-find
256 (lambda (x) 241 (lambda (x)
257 (string-match (shadow-cluster-regexp x) (shadow-name-site site))) 242 (string-match (shadow-cluster-regexp x) (shadow-name-site site)))
258 shadow-clusters))) 243 shadow-clusters)))
@@ -653,7 +638,7 @@ Consider them as regular expressions if third arg REGEXP is true."
653 shadows shadow-files-to-copy (with-output-to-string (backtrace)))) 638 shadows shadow-files-to-copy (with-output-to-string (backtrace))))
654 (when shadows 639 (when shadows
655 (setq shadow-files-to-copy 640 (setq shadow-files-to-copy
656 (shadow-union shadows shadow-files-to-copy)) 641 (cl-union shadows shadow-files-to-copy :test #'equal))
657 (when (not shadow-inhibit-message) 642 (when (not shadow-inhibit-message)
658 (message "%s" (substitute-command-keys 643 (message "%s" (substitute-command-keys
659 "Use \\[shadow-copy-files] to update shadows.")) 644 "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."
839 ;; continue standard unloading 824 ;; continue standard unloading
840 nil) 825 nil)
841 826
827;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
828;;; Obsolete
829;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
830
831(defun shadow-union (a b)
832 "Add members of list A to list B if not equal to items already in B."
833 (declare (obsolete cl-union "28.1"))
834 (cl-union a b :test #'equal))
835
836(define-obsolete-function-alias 'shadow-find #'seq-find "28.1")
837
842(provide 'shadowfile) 838(provide 'shadowfile)
843 839
844;;; shadowfile.el ends here 840;;; shadowfile.el ends here