aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2025-09-15 18:26:50 +0200
committerMichael Albinus2025-09-15 18:26:50 +0200
commitd6a7b0cd33c6300aeba184d1e7b5fdec41704058 (patch)
treeae732004143d3f2c26e7608384f6c1ee9590fd06
parent72c19d0f395e8883c65689c86e79905a34d36586 (diff)
downloademacs-d6a7b0cd33c6300aeba184d1e7b5fdec41704058.tar.gz
emacs-d6a7b0cd33c6300aeba184d1e7b5fdec41704058.zip
Tramp code cleanup
* lisp/net/tramp.el (tramp-use-absolute-autoload-file-names) (tramp-skeleton-file-name-all-completions) (tramp-parse-auth-sources, tramp-parse-file, tramp-parse-netrc): * lisp/net/tramp-cache.el (tramp-parse-connection-properties): * lisp/net/tramp-gvfs.el (tramp-gvfs-parse-device-names): * lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory): Use `seq-uniq'. * lisp/net/tramp.el (tramp-register-foreign-file-name-handler): * lisp/net/tramp-fuse.el (tramp-fuse-handle-directory-files): Use `seq-union'. * test/lisp/net/tramp-archive-tests.el (tramp-archive-test17-insert-directory): * test/lisp/net/tramp-tests.el (tramp-test17-insert-directory): Use `seq-union'. (tramp-test42-utf8): Use `seq-uniq' and `tramp-compat-seq-keep'.
-rw-r--r--lisp/net/tramp-cache.el2
-rw-r--r--lisp/net/tramp-fuse.el9
-rw-r--r--lisp/net/tramp-gvfs.el2
-rw-r--r--lisp/net/tramp-sh.el2
-rw-r--r--lisp/net/tramp.el25
-rw-r--r--test/lisp/net/tramp-archive-tests.el2
-rw-r--r--test/lisp/net/tramp-tests.el9
7 files changed, 24 insertions, 27 deletions
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 4ecc804bf20..eedb5a3e9ba 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -647,7 +647,7 @@ your laptop to different networks frequently."
647 "Return a list of (user host) tuples allowed to access for METHOD. 647 "Return a list of (user host) tuples allowed to access for METHOD.
648This function is added always in `tramp-get-completion-function' 648This function is added always in `tramp-get-completion-function'
649for all methods. Resulting data are derived from connection history." 649for all methods. Resulting data are derived from connection history."
650 (delete-dups 650 (seq-uniq
651 (tramp-compat-seq-keep 651 (tramp-compat-seq-keep
652 (lambda (key) 652 (lambda (key)
653 (let ((tramp-verbose 0)) 653 (let ((tramp-verbose 0))
diff --git a/lisp/net/tramp-fuse.el b/lisp/net/tramp-fuse.el
index 72b1934faca..07f4ef74581 100644
--- a/lisp/net/tramp-fuse.el
+++ b/lisp/net/tramp-fuse.el
@@ -59,11 +59,10 @@
59 (let ((result 59 (let ((result
60 (tramp-skeleton-directory-files directory full match nosort count 60 (tramp-skeleton-directory-files directory full match nosort count
61 ;; Some storage systems do not return "." and "..". 61 ;; Some storage systems do not return "." and "..".
62 (delete-dups 62 (seq-union
63 (append 63 '("." "..")
64 '("." "..") 64 (tramp-fuse-remove-hidden-files
65 (tramp-fuse-remove-hidden-files 65 (directory-files (tramp-fuse-local-file-name directory)))))))
66 (directory-files (tramp-fuse-local-file-name directory))))))))
67 (if full 66 (if full
68 ;; Massage the result. 67 ;; Massage the result.
69 (let ((local (rx 68 (let ((local (rx
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 7f3ac945bb6..c283c119b87 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -2556,7 +2556,7 @@ This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi."
2556 (split-string 2556 (split-string
2557 (shell-command-to-string (format "avahi-browse -trkp %s" service)) 2557 (shell-command-to-string (format "avahi-browse -trkp %s" service))
2558 (rx (+ (any "\r\n"))) 'omit (rx bol "+;" (* nonl) eol))))) 2558 (rx (+ (any "\r\n"))) 'omit (rx bol "+;" (* nonl) eol)))))
2559 (delete-dups 2559 (seq-uniq
2560 (tramp-compat-seq-keep 2560 (tramp-compat-seq-keep
2561 (lambda (x) 2561 (lambda (x)
2562 (ignore-errors 2562 (ignore-errors
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 0a454fed69b..8922adb7586 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2770,7 +2770,7 @@ The method used must be an out-of-band method."
2770 #'file-name-directory (list localname)))) 2770 #'file-name-directory (list localname))))
2771 (unless (or full-directory-p (member "-d" switches)) 2771 (unless (or full-directory-p (member "-d" switches))
2772 (setq switches (append switches '("-d")))) 2772 (setq switches (append switches '("-d"))))
2773 (setq switches (delete-dups switches) 2773 (setq switches (seq-uniq switches)
2774 switches (mapconcat #'tramp-shell-quote-argument switches " ")) 2774 switches (mapconcat #'tramp-shell-quote-argument switches " "))
2775 (when wildcard 2775 (when wildcard
2776 (setq switches (concat switches " " wildcard))) 2776 (setq switches (concat switches " " wildcard)))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index a27e8b8fbe8..e8f791c567b 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2729,7 +2729,7 @@ This avoids problems during autoload, when `load-path' contains
2729remote file names." 2729remote file names."
2730 ;; We expect all other Tramp files in the same directory as tramp.el. 2730 ;; We expect all other Tramp files in the same directory as tramp.el.
2731 (let* ((dir (expand-file-name (file-name-directory (locate-library "tramp")))) 2731 (let* ((dir (expand-file-name (file-name-directory (locate-library "tramp"))))
2732 (files (delete-dups 2732 (files (seq-uniq
2733 (mapcar 2733 (mapcar
2734 #'file-name-sans-extension 2734 #'file-name-sans-extension
2735 (directory-files 2735 (directory-files
@@ -2803,12 +2803,11 @@ whether HANDLER is to be called. Add operations defined in
2803 ;; Mark `operations' the handler is responsible for. 2803 ;; Mark `operations' the handler is responsible for.
2804 (put #'tramp-file-name-handler 2804 (put #'tramp-file-name-handler
2805 'operations 2805 'operations
2806 (delete-dups 2806 (seq-union
2807 (append 2807 (get 'tramp-file-name-handler 'operations)
2808 (get 'tramp-file-name-handler 'operations) 2808 (mapcar
2809 (mapcar 2809 #'car
2810 #'car 2810 (symbol-value (intern (concat (symbol-name handler) "-alist")))))))
2811 (symbol-value (intern (concat (symbol-name handler) "-alist"))))))))
2812 2811
2813(defun tramp-exists-file-name-handler (operation &rest args) 2812(defun tramp-exists-file-name-handler (operation &rest args)
2814 "Check, whether OPERATION runs a file name handler." 2813 "Check, whether OPERATION runs a file name handler."
@@ -2979,7 +2978,7 @@ not in completion mode."
2979BODY is the backend specific code." 2978BODY is the backend specific code."
2980 (declare (indent 2) (debug t)) 2979 (declare (indent 2) (debug t))
2981 `(ignore-error file-missing 2980 `(ignore-error file-missing
2982 (delete-dups (delq nil (delete "" 2981 (seq-uniq (delq nil (delete ""
2983 (let* ((case-fold-search read-file-name-completion-ignore-case) 2982 (let* ((case-fold-search read-file-name-completion-ignore-case)
2984 (result (progn ,@body))) 2983 (result (progn ,@body)))
2985 ;; Some storage systems do not return "." and "..". 2984 ;; Some storage systems do not return "." and "..".
@@ -3372,7 +3371,7 @@ as for \"~/.authinfo.gpg\"."
3372This function is added always in `tramp-get-completion-function' 3371This function is added always in `tramp-get-completion-function'
3373for all methods. Resulting data are derived from default settings." 3372for all methods. Resulting data are derived from default settings."
3374 (and tramp-completion-use-auth-sources 3373 (and tramp-completion-use-auth-sources
3375 (delete-dups 3374 (seq-uniq
3376 (tramp-compat-seq-keep 3375 (tramp-compat-seq-keep
3377 (lambda (x) `(,(plist-get x :user) ,(plist-get x :host))) 3376 (lambda (x) `(,(plist-get x :user) ,(plist-get x :host)))
3378 (auth-source-search 3377 (auth-source-search
@@ -3401,7 +3400,7 @@ User is always nil."
3401 (with-temp-buffer 3400 (with-temp-buffer
3402 (insert-file-contents-literally filename) 3401 (insert-file-contents-literally filename)
3403 (goto-char (point-min)) 3402 (goto-char (point-min))
3404 (delete-dups (delq nil 3403 (seq-uniq (delq nil
3405 (cl-loop while (not (eobp)) collect (funcall function)))))))) 3404 (cl-loop while (not (eobp)) collect (funcall function))))))))
3406 3405
3407(defun tramp-parse-rhosts (filename) 3406(defun tramp-parse-rhosts (filename)
@@ -3538,7 +3537,7 @@ Host is always \"localhost\"."
3538(defun tramp-parse-netrc (filename) 3537(defun tramp-parse-netrc (filename)
3539 "Return a list of (user host) tuples allowed to access. 3538 "Return a list of (user host) tuples allowed to access.
3540User may be nil." 3539User may be nil."
3541 (delete-dups 3540 (seq-uniq
3542 (tramp-compat-seq-keep 3541 (tramp-compat-seq-keep
3543 (lambda (item) 3542 (lambda (item)
3544 (and (assoc "machine" item) 3543 (and (assoc "machine" item)
@@ -5347,8 +5346,8 @@ should be set connection-local.")
5347 (or (not (stringp buffer)) (not (tramp-tramp-file-p buffer))) 5346 (or (not (stringp buffer)) (not (tramp-tramp-file-p buffer)))
5348 (or (not (stringp stderr)) (not (tramp-tramp-file-p stderr)))))) 5347 (or (not (stringp stderr)) (not (tramp-tramp-file-p stderr))))))
5349 5348
5350;; This function is used by tramp-*-handle-make-process and 5349;; This function is used by `tramp-*-handle-make-process' and
5351;; tramp-sh-handle-process-file to filter local environment variables 5350;; `tramp-sh-handle-process-file' to filter local environment variables
5352;; that should not be propagated remotely. Users can override this 5351;; that should not be propagated remotely. Users can override this
5353;; function if necessary, for example, to ensure that a specific 5352;; function if necessary, for example, to ensure that a specific
5354;; environment variable is applied to remote processes, whether it 5353;; environment variable is applied to remote processes, whether it
diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el
index 0ff0f3ddd4d..33dc0b9d4af 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -559,7 +559,7 @@ This checks also `file-name-as-directory', `file-name-directory',
559 559
560 (let (;; We test for the summary line. Keyword "total" could be localized. 560 (let (;; We test for the summary line. Keyword "total" could be localized.
561 (process-environment 561 (process-environment
562 (append '("LANG=C" "LANGUAGE=C" "LC_ALL=C") process-environment))) 562 (seq-union '("LANG=C" "LANGUAGE=C" "LC_ALL=C") process-environment)))
563 (unwind-protect 563 (unwind-protect
564 (progn 564 (progn
565 (with-temp-buffer 565 (with-temp-buffer
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 7b90bb4d9be..e011b99be57 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -3515,7 +3515,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
3515 (tmp-name2 (expand-file-name "foo" tmp-name1)) 3515 (tmp-name2 (expand-file-name "foo" tmp-name1))
3516 ;; We test for the summary line. Keyword "total" could be localized. 3516 ;; We test for the summary line. Keyword "total" could be localized.
3517 (process-environment 3517 (process-environment
3518 (append '("LANG=C" "LANGUAGE=C" "LC_ALL=C") process-environment))) 3518 (seq-union '("LANG=C" "LANGUAGE=C" "LC_ALL=C") process-environment)))
3519 (unwind-protect 3519 (unwind-protect
3520 (progn 3520 (progn
3521 (make-directory tmp-name1) 3521 (make-directory tmp-name1)
@@ -5656,8 +5656,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
5656(ert-deftest tramp-test30-make-process () 5656(ert-deftest tramp-test30-make-process ()
5657 "Check `make-process'." 5657 "Check `make-process'."
5658 :tags (append '(:expensive-test :tramp-asynchronous-processes) 5658 :tags (append '(:expensive-test :tramp-asynchronous-processes)
5659 (and (getenv "EMACS_EMBA_CI") 5659 (and (getenv "EMACS_EMBA_CI") '(:unstable)))
5660 '(:unstable)))
5661 (skip-unless (tramp--test-enabled)) 5660 (skip-unless (tramp--test-enabled))
5662 (skip-unless (tramp--test-supports-processes-p)) 5661 (skip-unless (tramp--test-supports-processes-p))
5663 5662
@@ -7887,8 +7886,8 @@ This requires restrictions of file name syntax."
7887 "🌈🍒👋") 7886 "🌈🍒👋")
7888 7887
7889 (when (and (tramp--test-expensive-test-p) (not (tramp--test-windows-nt-p))) 7888 (when (and (tramp--test-expensive-test-p) (not (tramp--test-windows-nt-p)))
7890 (delete-dups 7889 (seq-uniq
7891 (mapcar 7890 (tramp-compat-seq-keep
7892 ;; Use all available language specific snippets. 7891 ;; Use all available language specific snippets.
7893 (lambda (x) 7892 (lambda (x)
7894 (and 7893 (and