Don't attempt to connect to a remote server during 'abbreviate-file-name'
* lisp/net/tramp.el (tramp-handle-abbreviate-file-name): Only use the "home-directory" when a connection has been established.
This commit is contained in:
committed by
Stefan Monnier
parent
8a2f73f12a
commit
a4dd94de80
@@ -3343,16 +3343,24 @@ User is always nil."
|
|||||||
(let* ((case-fold-search (file-name-case-insensitive-p filename))
|
(let* ((case-fold-search (file-name-case-insensitive-p filename))
|
||||||
(vec (tramp-dissect-file-name filename))
|
(vec (tramp-dissect-file-name filename))
|
||||||
(home-dir
|
(home-dir
|
||||||
(with-tramp-connection-property vec "home-directory"
|
(if (let ((non-essential t)) (tramp-connectable-p vec))
|
||||||
(tramp-compat-funcall
|
;; If a connection has already been established, make
|
||||||
'directory-abbrev-apply
|
;; sure the "home-directory" connection property is
|
||||||
(expand-file-name (tramp-make-tramp-file-name vec "~"))))))
|
;; properly set.
|
||||||
|
(with-tramp-connection-property vec "home-directory"
|
||||||
|
(tramp-compat-funcall
|
||||||
|
'directory-abbrev-apply
|
||||||
|
(expand-file-name (tramp-make-tramp-file-name vec "~"))))
|
||||||
|
;; Otherwise, just use the cached value.
|
||||||
|
(tramp-get-connection-property vec "home-directory" nil))))
|
||||||
;; If any elt of `directory-abbrev-alist' matches this name,
|
;; If any elt of `directory-abbrev-alist' matches this name,
|
||||||
;; abbreviate accordingly.
|
;; abbreviate accordingly.
|
||||||
(setq filename (tramp-compat-funcall 'directory-abbrev-apply filename))
|
(setq filename (tramp-compat-funcall 'directory-abbrev-apply filename))
|
||||||
;; Abbreviate home directory.
|
;; Abbreviate home directory.
|
||||||
(if (string-match
|
(if (and home-dir
|
||||||
(tramp-compat-funcall 'directory-abbrev-make-regexp home-dir) filename)
|
(string-match
|
||||||
|
(tramp-compat-funcall 'directory-abbrev-make-regexp home-dir)
|
||||||
|
filename))
|
||||||
(tramp-make-tramp-file-name
|
(tramp-make-tramp-file-name
|
||||||
vec (concat "~" (substring filename (match-beginning 1))))
|
vec (concat "~" (substring filename (match-beginning 1))))
|
||||||
(tramp-make-tramp-file-name (tramp-dissect-file-name filename)))))
|
(tramp-make-tramp-file-name (tramp-dissect-file-name filename)))))
|
||||||
|
|||||||
Reference in New Issue
Block a user