mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Simplify Tramp autoloading.
* lisp/net/tramp.el (tramp-completion-file-name-handler): Simplify autoloading. Give it the `operations' property. (tramp-completion-handle-expand-file-name): Remove.
This commit is contained in:
parent
8275687bb9
commit
541e950bdb
1 changed files with 7 additions and 25 deletions
|
|
@ -1055,8 +1055,7 @@ means to use always cached values for the directory contents."
|
|||
|
||||
;;;###autoload
|
||||
(defconst tramp-completion-file-name-handler-alist
|
||||
'(;(expand-file-name . tramp-completion-handle-expand-file-name)
|
||||
(file-name-all-completions
|
||||
'((file-name-all-completions
|
||||
. tramp-completion-handle-file-name-all-completions)
|
||||
(file-name-completion . tramp-completion-handle-file-name-completion))
|
||||
"Alist of completion handler functions.
|
||||
|
|
@ -2113,20 +2112,7 @@ preventing reentrant calls of Tramp.")
|
|||
Together with `tramp-locked', this implements a locking mechanism
|
||||
preventing reentrant calls of Tramp.")
|
||||
|
||||
;; Avoid recursive loading of tramp.el.
|
||||
;; FIXME: This must go better. Checking for `operation' is wrong.
|
||||
;;;###autoload(defun tramp-completion-file-name-handler (operation &rest args)
|
||||
;;;###autoload (let ((fn
|
||||
;;;###autoload (assoc
|
||||
;;;###autoload operation tramp-completion-file-name-handler-alist)))
|
||||
;;;###autoload (if (and
|
||||
;;;###autoload tramp-mode fn (null load-in-progress)
|
||||
;;;###autoload (member
|
||||
;;;###autoload operation
|
||||
;;;###autoload '(file-name-all-completions file-name-completion)))
|
||||
;;;###autoload (apply 'tramp-autoload-file-name-handler operation args)
|
||||
;;;###autoload (tramp-run-real-handler operation args))))
|
||||
|
||||
;;;###autoload
|
||||
(defun tramp-completion-file-name-handler (operation &rest args)
|
||||
"Invoke Tramp file name completion handler.
|
||||
Falls 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."
|
|||
(save-match-data (apply (cdr fn) args))
|
||||
(tramp-run-real-handler operation args))))
|
||||
|
||||
;; Mark `operations' the handler is responsible for.
|
||||
;;;###autoload
|
||||
(put 'tramp-completion-file-name-handler 'operations
|
||||
(mapcar 'car tramp-completion-file-name-handler-alist))
|
||||
|
||||
;;;###autoload
|
||||
(progn (defun tramp-autoload-file-name-handler (operation &rest args)
|
||||
"Load Tramp file name handler, and perform OPERATION."
|
||||
|
|
@ -2258,15 +2249,6 @@ not in completion mode."
|
|||
(tramp-get-connection-process
|
||||
(tramp-dissect-file-name filename)))))))
|
||||
|
||||
(defun tramp-completion-handle-expand-file-name (name &optional dir)
|
||||
"Like `expand-file-name' for Tramp files."
|
||||
;; If DIR is not given, use `default-directory' or "/".
|
||||
(setq dir (or dir default-directory "/"))
|
||||
(cond
|
||||
((file-name-absolute-p name) name)
|
||||
((zerop (length name)) dir)
|
||||
(t (concat (file-name-as-directory dir) name))))
|
||||
|
||||
;; Method, host name and user name completion.
|
||||
;; `tramp-completion-dissect-file-name' returns a list of
|
||||
;; tramp-file-name structures. For all of them we return possible completions.
|
||||
|
|
|
|||
Loading…
Reference in a new issue