aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/net/tramp.el32
1 files changed, 7 insertions, 25 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index a9254693adb..a7c36c09e08 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1055,8 +1055,7 @@ means to use always cached values for the directory contents."
1055 1055
1056;;;###autoload 1056;;;###autoload
1057(defconst tramp-completion-file-name-handler-alist 1057(defconst tramp-completion-file-name-handler-alist
1058 '(;(expand-file-name . tramp-completion-handle-expand-file-name) 1058 '((file-name-all-completions
1059 (file-name-all-completions
1060 . tramp-completion-handle-file-name-all-completions) 1059 . tramp-completion-handle-file-name-all-completions)
1061 (file-name-completion . tramp-completion-handle-file-name-completion)) 1060 (file-name-completion . tramp-completion-handle-file-name-completion))
1062 "Alist of completion handler functions. 1061 "Alist of completion handler functions.
@@ -2113,20 +2112,7 @@ preventing reentrant calls of Tramp.")
2113Together with `tramp-locked', this implements a locking mechanism 2112Together with `tramp-locked', this implements a locking mechanism
2114preventing reentrant calls of Tramp.") 2113preventing reentrant calls of Tramp.")
2115 2114
2116;; Avoid recursive loading of tramp.el. 2115;;;###autoload
2117;; FIXME: This must go better. Checking for `operation' is wrong.
2118;;;###autoload(defun tramp-completion-file-name-handler (operation &rest args)
2119;;;###autoload (let ((fn
2120;;;###autoload (assoc
2121;;;###autoload operation tramp-completion-file-name-handler-alist)))
2122;;;###autoload (if (and
2123;;;###autoload tramp-mode fn (null load-in-progress)
2124;;;###autoload (member
2125;;;###autoload operation
2126;;;###autoload '(file-name-all-completions file-name-completion)))
2127;;;###autoload (apply 'tramp-autoload-file-name-handler operation args)
2128;;;###autoload (tramp-run-real-handler operation args))))
2129
2130(defun tramp-completion-file-name-handler (operation &rest args) 2116(defun tramp-completion-file-name-handler (operation &rest args)
2131 "Invoke Tramp file name completion handler. 2117 "Invoke Tramp file name completion handler.
2132Falls back to normal file name handler if no Tramp file name handler exists." 2118Falls back to normal file name handler if no Tramp file name handler exists."
@@ -2135,6 +2121,11 @@ Falls back to normal file name handler if no Tramp file name handler exists."
2135 (save-match-data (apply (cdr fn) args)) 2121 (save-match-data (apply (cdr fn) args))
2136 (tramp-run-real-handler operation args)))) 2122 (tramp-run-real-handler operation args))))
2137 2123
2124;; Mark `operations' the handler is responsible for.
2125;;;###autoload
2126(put 'tramp-completion-file-name-handler 'operations
2127 (mapcar 'car tramp-completion-file-name-handler-alist))
2128
2138;;;###autoload 2129;;;###autoload
2139(progn (defun tramp-autoload-file-name-handler (operation &rest args) 2130(progn (defun tramp-autoload-file-name-handler (operation &rest args)
2140 "Load Tramp file name handler, and perform OPERATION." 2131 "Load Tramp file name handler, and perform OPERATION."
@@ -2258,15 +2249,6 @@ not in completion mode."
2258 (tramp-get-connection-process 2249 (tramp-get-connection-process
2259 (tramp-dissect-file-name filename))))))) 2250 (tramp-dissect-file-name filename)))))))
2260 2251
2261(defun tramp-completion-handle-expand-file-name (name &optional dir)
2262 "Like `expand-file-name' for Tramp files."
2263 ;; If DIR is not given, use `default-directory' or "/".
2264 (setq dir (or dir default-directory "/"))
2265 (cond
2266 ((file-name-absolute-p name) name)
2267 ((zerop (length name)) dir)
2268 (t (concat (file-name-as-directory dir) name))))
2269
2270;; Method, host name and user name completion. 2252;; Method, host name and user name completion.
2271;; `tramp-completion-dissect-file-name' returns a list of 2253;; `tramp-completion-dissect-file-name' returns a list of
2272;; tramp-file-name structures. For all of them we return possible completions. 2254;; tramp-file-name structures. For all of them we return possible completions.