diff options
| author | Michael Albinus | 2023-11-17 18:16:58 +0100 |
|---|---|---|
| committer | Michael Albinus | 2023-11-17 18:16:58 +0100 |
| commit | 7b0e07c41ae92d4cb139b1c47ce9debc37cfffcb (patch) | |
| tree | 41071907b620d19187a9f67e24517ab87b32ba10 | |
| parent | 232a57a3e32f8dc425887f6edda172255b265de3 (diff) | |
| download | emacs-7b0e07c41ae92d4cb139b1c47ce9debc37cfffcb.tar.gz emacs-7b0e07c41ae92d4cb139b1c47ce9debc37cfffcb.zip | |
Make Tramp aware of completion-regexp-list (don't merge)
* lisp/net/tramp.el (tramp-skeleton-file-name-all-completions):
New defmacro.
(tramp-completion-handle-file-name-all-completions):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions):
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-name-all-completions):
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
* lisp/net/tramp-smb.el (tramp-smb-handle-file-name-all-completions):
* lisp/net/tramp-sudoedit.el
(tramp-sudoedit-handle-file-name-all-completions): Use it.
| -rw-r--r-- | lisp/net/tramp-adb.el | 21 | ||||
| -rw-r--r-- | lisp/net/tramp-crypt.el | 2 | ||||
| -rw-r--r-- | lisp/net/tramp-fuse.el | 27 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 4 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 81 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 17 | ||||
| -rw-r--r-- | lisp/net/tramp-sudoedit.el | 14 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 161 |
8 files changed, 168 insertions, 159 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index f16c97a235c..27645e143af 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -449,7 +449,7 @@ Emacs dired can't find files." | |||
| 449 | 449 | ||
| 450 | (defun tramp-adb-handle-file-name-all-completions (filename directory) | 450 | (defun tramp-adb-handle-file-name-all-completions (filename directory) |
| 451 | "Like `file-name-all-completions' for Tramp files." | 451 | "Like `file-name-all-completions' for Tramp files." |
| 452 | (tramp-compat-ignore-error file-missing | 452 | (tramp-skeleton-file-name-all-completions filename directory |
| 453 | (all-completions | 453 | (all-completions |
| 454 | filename | 454 | filename |
| 455 | (with-parsed-tramp-file-name (expand-file-name directory) nil | 455 | (with-parsed-tramp-file-name (expand-file-name directory) nil |
| @@ -464,17 +464,14 @@ Emacs dired can't find files." | |||
| 464 | (file-name-as-directory f) | 464 | (file-name-as-directory f) |
| 465 | f)) | 465 | f)) |
| 466 | (with-current-buffer (tramp-get-buffer v) | 466 | (with-current-buffer (tramp-get-buffer v) |
| 467 | (delete-dups | 467 | (append |
| 468 | (append | 468 | ;; On some file systems like "sdcard", "." and ".." are |
| 469 | ;; On some file systems like "sdcard", "." and ".." are | 469 | ;; not included. |
| 470 | ;; not included. We fix this by `delete-dups'. | 470 | '("." "..") |
| 471 | '("." "..") | 471 | (mapcar |
| 472 | (delq | 472 | (lambda (l) |
| 473 | nil | 473 | (and (not (string-match-p (rx bol (* blank) eol) l)) l)) |
| 474 | (mapcar | 474 | (split-string (buffer-string) "\n" 'omit)))))))))) |
| 475 | (lambda (l) | ||
| 476 | (and (not (string-match-p (rx bol (* blank) eol) l)) l)) | ||
| 477 | (split-string (buffer-string) "\n")))))))))))) | ||
| 478 | 475 | ||
| 479 | (defun tramp-adb-handle-file-local-copy (filename) | 476 | (defun tramp-adb-handle-file-local-copy (filename) |
| 480 | "Like `file-local-copy' for Tramp files." | 477 | "Like `file-local-copy' for Tramp files." |
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el index 62cd3f0a3b2..1cc4e96bc99 100644 --- a/lisp/net/tramp-crypt.el +++ b/lisp/net/tramp-crypt.el | |||
| @@ -735,7 +735,7 @@ absolute file names." | |||
| 735 | 735 | ||
| 736 | (defun tramp-crypt-handle-file-name-all-completions (filename directory) | 736 | (defun tramp-crypt-handle-file-name-all-completions (filename directory) |
| 737 | "Like `file-name-all-completions' for Tramp files." | 737 | "Like `file-name-all-completions' for Tramp files." |
| 738 | (tramp-compat-ignore-error file-missing | 738 | (tramp-skeleton-file-name-all-completions filename directory |
| 739 | (all-completions | 739 | (all-completions |
| 740 | filename | 740 | filename |
| 741 | (let* (completion-regexp-list | 741 | (let* (completion-regexp-list |
diff --git a/lisp/net/tramp-fuse.el b/lisp/net/tramp-fuse.el index e4610b069ad..1446d31a869 100644 --- a/lisp/net/tramp-fuse.el +++ b/lisp/net/tramp-fuse.el | |||
| @@ -104,22 +104,21 @@ | |||
| 104 | 104 | ||
| 105 | (defun tramp-fuse-handle-file-name-all-completions (filename directory) | 105 | (defun tramp-fuse-handle-file-name-all-completions (filename directory) |
| 106 | "Like `file-name-all-completions' for Tramp files." | 106 | "Like `file-name-all-completions' for Tramp files." |
| 107 | (tramp-fuse-remove-hidden-files | 107 | (tramp-skeleton-file-name-all-completions filename directory |
| 108 | (tramp-compat-ignore-error file-missing | 108 | (tramp-fuse-remove-hidden-files |
| 109 | (all-completions | 109 | (all-completions |
| 110 | filename | 110 | filename |
| 111 | (delete-dups | 111 | (append |
| 112 | (append | 112 | (file-name-all-completions |
| 113 | (file-name-all-completions | 113 | filename (tramp-fuse-local-file-name directory)) |
| 114 | filename (tramp-fuse-local-file-name directory)) | 114 | ;; Some storage systems do not return "." and "..". |
| 115 | ;; Some storage systems do not return "." and "..". | 115 | (let (result) |
| 116 | (let (result) | 116 | (dolist (item '(".." ".") result) |
| 117 | (dolist (item '(".." ".") result) | 117 | (when (string-prefix-p filename item) |
| 118 | (when (string-prefix-p filename item) | 118 | (catch 'match |
| 119 | (catch 'match | 119 | (dolist (elt completion-regexp-list) |
| 120 | (dolist (elt completion-regexp-list) | 120 | (unless (string-match-p elt item) (throw 'match nil))) |
| 121 | (unless (string-match-p elt item) (throw 'match nil))) | 121 | (setq result (cons (concat item "/") result))))))))))) |
| 122 | (setq result (cons (concat item "/") result)))))))))))) | ||
| 123 | 122 | ||
| 124 | ;; This function isn't used. | 123 | ;; This function isn't used. |
| 125 | (defun tramp-fuse-handle-insert-directory | 124 | (defun tramp-fuse-handle-insert-directory |
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 07390b50df2..9a94a2f4c9b 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -1434,8 +1434,8 @@ If FILE-SYSTEM is non-nil, return file system attributes." | |||
| 1434 | 1434 | ||
| 1435 | (defun tramp-gvfs-handle-file-name-all-completions (filename directory) | 1435 | (defun tramp-gvfs-handle-file-name-all-completions (filename directory) |
| 1436 | "Like `file-name-all-completions' for Tramp files." | 1436 | "Like `file-name-all-completions' for Tramp files." |
| 1437 | (unless (tramp-compat-string-search "/" filename) | 1437 | (tramp-skeleton-file-name-all-completions filename directory |
| 1438 | (tramp-compat-ignore-error file-missing | 1438 | (unless (tramp-compat-string-search "/" filename) |
| 1439 | (all-completions | 1439 | (all-completions |
| 1440 | filename | 1440 | filename |
| 1441 | (with-parsed-tramp-file-name (expand-file-name directory) nil | 1441 | (with-parsed-tramp-file-name (expand-file-name directory) nil |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 74b1638f120..7dc75cb337a 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -1831,46 +1831,47 @@ ID-FORMAT valid values are `string' and `integer'." | |||
| 1831 | ;; files. | 1831 | ;; files. |
| 1832 | (defun tramp-sh-handle-file-name-all-completions (filename directory) | 1832 | (defun tramp-sh-handle-file-name-all-completions (filename directory) |
| 1833 | "Like `file-name-all-completions' for Tramp files." | 1833 | "Like `file-name-all-completions' for Tramp files." |
| 1834 | (with-parsed-tramp-file-name (expand-file-name directory) nil | 1834 | (tramp-skeleton-file-name-all-completions filename directory |
| 1835 | (when (and (not (tramp-compat-string-search "/" filename)) | 1835 | (with-parsed-tramp-file-name (expand-file-name directory) nil |
| 1836 | (tramp-connectable-p v)) | 1836 | (when (and (not (tramp-compat-string-search "/" filename)) |
| 1837 | (unless (tramp-compat-string-search "/" filename) | 1837 | (tramp-connectable-p v)) |
| 1838 | (tramp-compat-ignore-error file-missing | 1838 | (unless (tramp-compat-string-search "/" filename) |
| 1839 | (all-completions | 1839 | (all-completions |
| 1840 | filename | 1840 | filename |
| 1841 | (with-tramp-file-property v localname "file-name-all-completions" | 1841 | (with-tramp-file-property v localname "file-name-all-completions" |
| 1842 | (let (result) | 1842 | (let (result) |
| 1843 | ;; Get a list of directories and files, including | 1843 | ;; Get a list of directories and files, including |
| 1844 | ;; reliably tagging the directories with a trailing "/". | 1844 | ;; reliably tagging the directories with a trailing "/". |
| 1845 | ;; Because I rock. --daniel@danann.net | 1845 | ;; Because I rock. --daniel@danann.net |
| 1846 | (when (tramp-send-command-and-check | 1846 | (when (tramp-send-command-and-check |
| 1847 | v | 1847 | v |
| 1848 | (if (tramp-get-remote-perl v) | 1848 | (if (tramp-get-remote-perl v) |
| 1849 | (progn | 1849 | (progn |
| 1850 | (tramp-maybe-send-script | 1850 | (tramp-maybe-send-script |
| 1851 | v tramp-perl-file-name-all-completions | 1851 | v tramp-perl-file-name-all-completions |
| 1852 | "tramp_perl_file_name_all_completions") | 1852 | "tramp_perl_file_name_all_completions") |
| 1853 | (format "tramp_perl_file_name_all_completions %s" | 1853 | (format "tramp_perl_file_name_all_completions %s" |
| 1854 | (tramp-shell-quote-argument localname))) | 1854 | (tramp-shell-quote-argument localname))) |
| 1855 | 1855 | ||
| 1856 | (format (concat | 1856 | (format (concat |
| 1857 | "cd %s 2>&1 && %s -a 2>%s" | 1857 | "cd %s 2>&1 && %s -a 2>%s" |
| 1858 | " | while IFS= read f; do" | 1858 | " | while IFS= read f; do" |
| 1859 | " if %s -d \"$f\" 2>%s;" | 1859 | " if %s -d \"$f\" 2>%s;" |
| 1860 | " then \\echo \"$f/\"; else \\echo \"$f\"; fi;" | 1860 | " then \\echo \"$f/\"; else \\echo \"$f\"; fi;" |
| 1861 | " done") | 1861 | " done") |
| 1862 | (tramp-shell-quote-argument localname) | 1862 | (tramp-shell-quote-argument localname) |
| 1863 | (tramp-get-ls-command v) | 1863 | (tramp-get-ls-command v) |
| 1864 | (tramp-get-remote-null-device v) | 1864 | (tramp-get-remote-null-device v) |
| 1865 | (tramp-get-test-command v) | 1865 | (tramp-get-test-command v) |
| 1866 | (tramp-get-remote-null-device v)))) | 1866 | (tramp-get-remote-null-device v)))) |
| 1867 | 1867 | ||
| 1868 | ;; Now grab the output. | 1868 | ;; Now grab the output. |
| 1869 | (with-current-buffer (tramp-get-buffer v) | 1869 | (with-current-buffer (tramp-get-buffer v) |
| 1870 | (goto-char (point-max)) | 1870 | (goto-char (point-max)) |
| 1871 | (while (zerop (forward-line -1)) | 1871 | (while (zerop (forward-line -1)) |
| 1872 | (push (buffer-substring (point) (line-end-position)) result))) | 1872 | (push |
| 1873 | result))))))))) | 1873 | (buffer-substring (point) (line-end-position)) result))) |
| 1874 | result))))))))) | ||
| 1874 | 1875 | ||
| 1875 | ;; cp, mv and ln | 1876 | ;; cp, mv and ln |
| 1876 | 1877 | ||
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 0ba24352a3d..5c385641cf8 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -987,20 +987,19 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 987 | ;; files. | 987 | ;; files. |
| 988 | (defun tramp-smb-handle-file-name-all-completions (filename directory) | 988 | (defun tramp-smb-handle-file-name-all-completions (filename directory) |
| 989 | "Like `file-name-all-completions' for Tramp files." | 989 | "Like `file-name-all-completions' for Tramp files." |
| 990 | (tramp-compat-ignore-error file-missing | 990 | (tramp-skeleton-file-name-all-completions filename directory |
| 991 | (all-completions | 991 | (all-completions |
| 992 | filename | 992 | filename |
| 993 | (when (file-directory-p directory) | 993 | (when (file-directory-p directory) |
| 994 | (with-parsed-tramp-file-name (expand-file-name directory) nil | 994 | (with-parsed-tramp-file-name (expand-file-name directory) nil |
| 995 | (with-tramp-file-property v localname "file-name-all-completions" | 995 | (with-tramp-file-property v localname "file-name-all-completions" |
| 996 | (delete-dups | 996 | (mapcar |
| 997 | (mapcar | 997 | (lambda (x) |
| 998 | (lambda (x) | 998 | (list |
| 999 | (list | 999 | (if (tramp-compat-string-search "d" (nth 1 x)) |
| 1000 | (if (tramp-compat-string-search "d" (nth 1 x)) | 1000 | (file-name-as-directory (nth 0 x)) |
| 1001 | (file-name-as-directory (nth 0 x)) | 1001 | (nth 0 x)))) |
| 1002 | (nth 0 x)))) | 1002 | (tramp-smb-get-file-entries directory)))))))) |
| 1003 | (tramp-smb-get-file-entries directory))))))))) | ||
| 1004 | 1003 | ||
| 1005 | (defun tramp-smb-handle-file-system-info (filename) | 1004 | (defun tramp-smb-handle-file-system-info (filename) |
| 1006 | "Like `file-system-info' for Tramp files." | 1005 | "Like `file-system-info' for Tramp files." |
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el index 9939d93ba35..092a414f3de 100644 --- a/lisp/net/tramp-sudoedit.el +++ b/lisp/net/tramp-sudoedit.el | |||
| @@ -467,7 +467,7 @@ the result will be a local, non-Tramp, file name." | |||
| 467 | 467 | ||
| 468 | (defun tramp-sudoedit-handle-file-name-all-completions (filename directory) | 468 | (defun tramp-sudoedit-handle-file-name-all-completions (filename directory) |
| 469 | "Like `file-name-all-completions' for Tramp files." | 469 | "Like `file-name-all-completions' for Tramp files." |
| 470 | (tramp-compat-ignore-error file-missing | 470 | (tramp-skeleton-file-name-all-completions filename directory |
| 471 | (all-completions | 471 | (all-completions |
| 472 | filename | 472 | filename |
| 473 | (with-parsed-tramp-file-name (expand-file-name directory) nil | 473 | (with-parsed-tramp-file-name (expand-file-name directory) nil |
| @@ -481,13 +481,11 @@ the result will be a local, non-Tramp, file name." | |||
| 481 | (if (ignore-errors (file-directory-p (expand-file-name f directory))) | 481 | (if (ignore-errors (file-directory-p (expand-file-name f directory))) |
| 482 | (file-name-as-directory f) | 482 | (file-name-as-directory f) |
| 483 | f)) | 483 | f)) |
| 484 | (delq | 484 | (mapcar |
| 485 | nil | 485 | (lambda (l) (and (not (string-match-p (rx bol (* blank) eol) l)) l)) |
| 486 | (mapcar | 486 | (split-string |
| 487 | (lambda (l) (and (not (string-match-p (rx bol (* blank) eol) l)) l)) | 487 | (tramp-get-buffer-string (tramp-get-connection-buffer v)) |
| 488 | (split-string | 488 | "\n" 'omit)))))))) |
| 489 | (tramp-get-buffer-string (tramp-get-connection-buffer v)) | ||
| 490 | "\n" 'omit))))))))) | ||
| 491 | 489 | ||
| 492 | (defun tramp-sudoedit-handle-file-readable-p (filename) | 490 | (defun tramp-sudoedit-handle-file-readable-p (filename) |
| 493 | "Like `file-readable-p' for Tramp files." | 491 | "Like `file-readable-p' for Tramp files." |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 29f5ffd68f0..8b1a49edbae 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3069,85 +3069,100 @@ not in completion mode." | |||
| 3069 | 3069 | ||
| 3070 | (tramp-run-real-handler #'file-exists-p (list filename)))) | 3070 | (tramp-run-real-handler #'file-exists-p (list filename)))) |
| 3071 | 3071 | ||
| 3072 | (defmacro tramp-skeleton-file-name-all-completions | ||
| 3073 | (_filename _directory &rest body) | ||
| 3074 | "Skeleton for `tramp-*-handle-filename-all-completions'. | ||
| 3075 | BODY is the backend specific code." | ||
| 3076 | (declare (indent 2) (debug t)) | ||
| 3077 | `(tramp-compat-ignore-error file-missing | ||
| 3078 | (delete-dups (delq nil | ||
| 3079 | (let* ((case-fold-search read-file-name-completion-ignore-case) | ||
| 3080 | (regexp (mapconcat #'identity completion-regexp-list "\\|")) | ||
| 3081 | (result ,@body)) | ||
| 3082 | (if (consp completion-regexp-list) | ||
| 3083 | ;; Discriminate over `completion-regexp-list'. | ||
| 3084 | (mapcar | ||
| 3085 | (lambda (x) (and (stringp x) (string-match-p regexp x) x)) | ||
| 3086 | result) | ||
| 3087 | result)))))) | ||
| 3088 | |||
| 3072 | ;; Method, host name and user name completion. | 3089 | ;; Method, host name and user name completion. |
| 3073 | ;; `tramp-completion-dissect-file-name' returns a list of | 3090 | ;; `tramp-completion-dissect-file-name' returns a list of |
| 3074 | ;; `tramp-file-name' structures. For all of them we return possible | 3091 | ;; `tramp-file-name' structures. For all of them we return possible |
| 3075 | ;; completions. | 3092 | ;; completions. |
| 3076 | (defun tramp-completion-handle-file-name-all-completions (filename directory) | 3093 | (defun tramp-completion-handle-file-name-all-completions (filename directory) |
| 3077 | "Like `file-name-all-completions' for partial Tramp files." | 3094 | "Like `file-name-all-completions' for partial Tramp files." |
| 3078 | (let ((fullname | 3095 | (tramp-skeleton-file-name-all-completions filename directory |
| 3079 | (tramp-drop-volume-letter (expand-file-name filename directory))) | 3096 | (let ((fullname |
| 3080 | ;; When `tramp-syntax' is `simplified', we need a default method. | 3097 | (tramp-drop-volume-letter (expand-file-name filename directory))) |
| 3081 | (tramp-default-method | 3098 | ;; When `tramp-syntax' is `simplified', we need a default method. |
| 3082 | (and (string-empty-p tramp-postfix-method-format) | 3099 | (tramp-default-method |
| 3083 | tramp-default-method)) | 3100 | (and (string-empty-p tramp-postfix-method-format) |
| 3084 | (tramp-default-method-alist | 3101 | tramp-default-method)) |
| 3085 | (and (string-empty-p tramp-postfix-method-format) | 3102 | (tramp-default-method-alist |
| 3086 | tramp-default-method-alist)) | 3103 | (and (string-empty-p tramp-postfix-method-format) |
| 3087 | tramp-default-user tramp-default-user-alist | 3104 | tramp-default-method-alist)) |
| 3088 | tramp-default-host tramp-default-host-alist | 3105 | tramp-default-user tramp-default-user-alist |
| 3089 | hop result result1) | 3106 | tramp-default-host tramp-default-host-alist |
| 3090 | 3107 | hop result result1) | |
| 3091 | ;; Suppress hop from completion. | 3108 | |
| 3092 | (when (string-match | 3109 | ;; Suppress hop from completion. |
| 3093 | (tramp-compat-rx | 3110 | (when (string-match |
| 3094 | (regexp tramp-prefix-regexp) | 3111 | (tramp-compat-rx |
| 3095 | (group (+ (regexp tramp-remote-file-name-spec-regexp) | 3112 | (regexp tramp-prefix-regexp) |
| 3096 | (regexp tramp-postfix-hop-regexp)))) | 3113 | (group (+ (regexp tramp-remote-file-name-spec-regexp) |
| 3097 | fullname) | 3114 | (regexp tramp-postfix-hop-regexp)))) |
| 3098 | (setq hop (match-string 1 fullname) | 3115 | fullname) |
| 3099 | fullname (replace-match "" nil nil fullname 1))) | 3116 | (setq hop (match-string 1 fullname) |
| 3100 | 3117 | fullname (replace-match "" nil nil fullname 1))) | |
| 3101 | ;; Possible completion structures. | 3118 | |
| 3102 | (dolist (elt (tramp-completion-dissect-file-name fullname)) | 3119 | ;; Possible completion structures. |
| 3103 | (let* ((method (tramp-file-name-method elt)) | 3120 | (dolist (elt (tramp-completion-dissect-file-name fullname)) |
| 3104 | (user (tramp-file-name-user elt)) | 3121 | (let* ((method (tramp-file-name-method elt)) |
| 3105 | (host (tramp-file-name-host elt)) | 3122 | (user (tramp-file-name-user elt)) |
| 3106 | (localname (tramp-file-name-localname elt)) | 3123 | (host (tramp-file-name-host elt)) |
| 3107 | (m (tramp-find-method method user host)) | 3124 | (localname (tramp-file-name-localname elt)) |
| 3108 | all-user-hosts) | 3125 | (m (tramp-find-method method user host)) |
| 3109 | 3126 | all-user-hosts) | |
| 3110 | (unless localname ;; Nothing to complete. | 3127 | |
| 3111 | 3128 | (unless localname ;; Nothing to complete. | |
| 3112 | (if (or user host) | 3129 | (if (or user host) |
| 3113 | 3130 | ;; Method dependent user / host combinations. | |
| 3114 | ;; Method dependent user / host combinations. | 3131 | (progn |
| 3115 | (progn | 3132 | (mapc |
| 3116 | (mapc | 3133 | (lambda (x) |
| 3117 | (lambda (x) | 3134 | (setq all-user-hosts |
| 3118 | (setq all-user-hosts | 3135 | (append all-user-hosts |
| 3119 | (append all-user-hosts | 3136 | (funcall (nth 0 x) (nth 1 x))))) |
| 3120 | (funcall (nth 0 x) (nth 1 x))))) | 3137 | (tramp-get-completion-function m)) |
| 3121 | (tramp-get-completion-function m)) | 3138 | |
| 3122 | 3139 | (setq result | |
| 3123 | (setq result | 3140 | (append result |
| 3124 | (append result | 3141 | (mapcar |
| 3125 | (mapcar | 3142 | (lambda (x) |
| 3126 | (lambda (x) | 3143 | (tramp-get-completion-user-host |
| 3127 | (tramp-get-completion-user-host | 3144 | method user host (nth 0 x) (nth 1 x))) |
| 3128 | method user host (nth 0 x) (nth 1 x))) | 3145 | (delq nil all-user-hosts))))) |
| 3129 | (delq nil all-user-hosts))))) | 3146 | |
| 3130 | 3147 | ;; Possible methods. | |
| 3131 | ;; Possible methods. | 3148 | (setq result |
| 3132 | (setq result | 3149 | (append result (tramp-get-completion-methods m))))))) |
| 3133 | (append result (tramp-get-completion-methods m))))))) | 3150 | |
| 3134 | 3151 | ;; Add hop. | |
| 3135 | ;; Unify list, add hop, remove nil elements. | 3152 | (dolist (elt result) |
| 3136 | (dolist (elt result) | 3153 | (when elt |
| 3137 | (when elt | 3154 | (string-match tramp-prefix-regexp elt) |
| 3138 | (string-match tramp-prefix-regexp elt) | 3155 | (setq elt (replace-match (concat tramp-prefix-format hop) nil nil elt)) |
| 3139 | (setq elt (replace-match (concat tramp-prefix-format hop) nil nil elt)) | 3156 | (push |
| 3140 | (push | 3157 | (substring elt (length (tramp-drop-volume-letter directory))) |
| 3141 | (substring elt (length (tramp-drop-volume-letter directory))) | 3158 | result1))) |
| 3142 | result1))) | 3159 | |
| 3143 | 3160 | ;; Complete local parts. | |
| 3144 | ;; Complete local parts. | 3161 | (append |
| 3145 | (delete-dups | 3162 | result1 |
| 3146 | (append | 3163 | (ignore-errors |
| 3147 | result1 | 3164 | (tramp-run-real-handler |
| 3148 | (ignore-errors | 3165 | #'file-name-all-completions (list filename directory))))))) |
| 3149 | (tramp-run-real-handler | ||
| 3150 | #'file-name-all-completions (list filename directory))))))) | ||
| 3151 | 3166 | ||
| 3152 | ;; Method, host name and user name completion for a file. | 3167 | ;; Method, host name and user name completion for a file. |
| 3153 | (defun tramp-completion-handle-file-name-completion | 3168 | (defun tramp-completion-handle-file-name-completion |