aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/net/tramp.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 32712efb3ea..3c06ad1630a 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3343,16 +3343,24 @@ User is always nil."
3343 (let* ((case-fold-search (file-name-case-insensitive-p filename)) 3343 (let* ((case-fold-search (file-name-case-insensitive-p filename))
3344 (vec (tramp-dissect-file-name filename)) 3344 (vec (tramp-dissect-file-name filename))
3345 (home-dir 3345 (home-dir
3346 (with-tramp-connection-property vec "home-directory" 3346 (if (let ((non-essential t)) (tramp-connectable-p vec))
3347 (tramp-compat-funcall 3347 ;; If a connection has already been established, make
3348 'directory-abbrev-apply 3348 ;; sure the "home-directory" connection property is
3349 (expand-file-name (tramp-make-tramp-file-name vec "~")))))) 3349 ;; properly set.
3350 (with-tramp-connection-property vec "home-directory"
3351 (tramp-compat-funcall
3352 'directory-abbrev-apply
3353 (expand-file-name (tramp-make-tramp-file-name vec "~"))))
3354 ;; Otherwise, just use the cached value.
3355 (tramp-get-connection-property vec "home-directory" nil))))
3350 ;; If any elt of `directory-abbrev-alist' matches this name, 3356 ;; If any elt of `directory-abbrev-alist' matches this name,
3351 ;; abbreviate accordingly. 3357 ;; abbreviate accordingly.
3352 (setq filename (tramp-compat-funcall 'directory-abbrev-apply filename)) 3358 (setq filename (tramp-compat-funcall 'directory-abbrev-apply filename))
3353 ;; Abbreviate home directory. 3359 ;; Abbreviate home directory.
3354 (if (string-match 3360 (if (and home-dir
3355 (tramp-compat-funcall 'directory-abbrev-make-regexp home-dir) filename) 3361 (string-match
3362 (tramp-compat-funcall 'directory-abbrev-make-regexp home-dir)
3363 filename))
3356 (tramp-make-tramp-file-name 3364 (tramp-make-tramp-file-name
3357 vec (concat "~" (substring filename (match-beginning 1)))) 3365 vec (concat "~" (substring filename (match-beginning 1))))
3358 (tramp-make-tramp-file-name (tramp-dissect-file-name filename))))) 3366 (tramp-make-tramp-file-name (tramp-dissect-file-name filename)))))