emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 541e950: Simplify Tramp autoloading.


From: Michael Albinus
Subject: [Emacs-diffs] master 541e950: Simplify Tramp autoloading.
Date: Sat, 25 Mar 2017 10:42:55 -0400 (EDT)

branch: master
commit 541e950bdb495ea63420dcf80727cd0075d62e04
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    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.
---
 lisp/net/tramp.el | 32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index a925469..a7c36c0 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."
 
 ;;;###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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]