diff options
author | Vibhav Pant <vibhavp@gmail.com> | 2017-02-13 17:07:36 +0530 |
---|---|---|
committer | Vibhav Pant <vibhavp@gmail.com> | 2017-02-13 17:07:36 +0530 |
commit | cb410433e069b5bb450193353c3fea8593a643a9 (patch) | |
tree | d2f4269781b4841e5a0c27ec57a5a4fbcec386c0 /lisp/net/tramp.el | |
parent | e742450427007cdde242c11380dfe32a950fab61 (diff) | |
parent | 4b18ef7ba3dd8aae4f3c3bf931365ef7da883baf (diff) | |
download | emacs-feature/byte-switch.tar.gz |
Merge branch 'master' into feature/byte-switchfeature/byte-switch
Diffstat (limited to 'lisp/net/tramp.el')
-rw-r--r-- | lisp/net/tramp.el | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 48dcd5edd11..4b5bd472632 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2133,9 +2133,13 @@ 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. +;; Avoid recursive loading of tramp.el. If `non-essential' is +;; non-nil, we must load tramp.el, in order to get the real definition +;; of `tramp-completion-file-name-handler'. ;;;###autoload(defun tramp-completion-file-name-handler (operation &rest args) -;;;###autoload (tramp-completion-run-real-handler operation args)) +;;;###autoload (if (and (boundp 'non-essential) (symbol-value 'non-essential)) +;;;###autoload (apply 'tramp-autoload-file-name-handler operation args) +;;;###autoload (tramp-completion-run-real-handler operation args))) (defun tramp-completion-file-name-handler (operation &rest args) "Invoke Tramp file name completion handler. @@ -2165,9 +2169,11 @@ Falls back to normal file name handler if no Tramp file name handler exists." (progn (defun tramp-autoload-file-name-handler (operation &rest args) "Load Tramp file name handler, and perform OPERATION." ;; Avoid recursive loading of tramp.el. - (let ((default-directory temporary-file-directory)) - (load "tramp" nil t)) - (apply operation args))) + (if (let ((default-directory temporary-file-directory)) + (and (null load-in-progress) (load "tramp" 'noerror 'nomessage))) + (apply operation args) + ;; tramp.el not available for loading, fall back. + (tramp-completion-run-real-handler operation args)))) ;; `tramp-autoload-file-name-handler' must be registered before ;; evaluation of site-start and init files, because there might exist @@ -2307,11 +2313,10 @@ not in completion mode." (progn ;; If DIR is not given, use `default-directory' or "/". (setq dir (or dir default-directory "/")) - ;; Unless NAME is absolute, concat DIR and NAME. - (unless (file-name-absolute-p name) - (setq name (concat (file-name-as-directory dir) name))) - ;; Return NAME. - name) + (cond + ((file-name-absolute-p name) name) + ((zerop (length name)) dir) + (t (concat (file-name-as-directory dir) name)))) (tramp-completion-run-real-handler 'expand-file-name (list name dir)))) |