emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 0769c99: Fix bug#25607


From: Michael Albinus
Subject: [Emacs-diffs] master 0769c99: Fix bug#25607
Date: Sun, 12 Feb 2017 12:19:45 -0500 (EST)

branch: master
commit 0769c9957852236dd913fd617fdbc79ad581341c
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Fix bug#25607
    
    * lisp/net/tramp.el (tramp-completion-file-name-handler):
    Improve autoloaded version.
    (tramp-autoload-file-name-handler): Avoid recursive load.
    (tramp-completion-handle-expand-file-name): Handle empty NAME.
    (Bug#25607)
---
 lisp/net/tramp.el | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 48dcd5e..4b5bd47 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))))



reply via email to

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