From: Michael Albinus Date: Thu, 25 May 2023 13:40:45 +0000 (+0200) Subject: Make last Tramp change less invasive X-Git-Tag: emacs-29.0.92~101 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=709d9020021eaaf1e1475f61b72b2405f4fd0bb3;p=emacs.git Make last Tramp change less invasive * lisp/net/tramp.el (tramp-dissect-file-name): Revert last change. (tramp-handle-file-name-as-directory) (tramp-handle-file-name-directory): Let-bind `tramp-default-proxies-alist'. --- diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index dac2bc8c43c..9f868ccdaa0 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1681,9 +1681,8 @@ The structure consists of method, user, domain, host, port, localname (file name on remote host), and hop. Unless NODEFAULT is non-nil, method, user and host are expanded -to their default values. Hop is set to nil if NODEFAULT is non-nil. - -For the other file name parts, no default values are used." +to their default values. For the other file name parts, no +default values are used." (save-match-data (unless (tramp-tramp-file-p name) (tramp-user-error nil "Not a Tramp file name: \"%s\"" name)) @@ -1709,8 +1708,7 @@ For the other file name parts, no default values are used." (when (string-match tramp-postfix-ipv6-regexp host) (setq host (replace-match "" nil t host)))) - (if nodefault - (setq hop nil) + (unless nodefault (when hop (setq v (tramp-dissect-hop-name hop) hop (and hop (tramp-make-tramp-hop-name v)))) @@ -3894,8 +3892,10 @@ Let-bind it when necessary.") (defun tramp-handle-file-name-as-directory (file) "Like `file-name-as-directory' for Tramp files." ;; `file-name-as-directory' would be sufficient except localname is - ;; the empty string. - (let ((v (tramp-dissect-file-name file t))) + ;; the empty string. Suppress adding a hop to + ;; `tramp-default-proxies-alist' due to non-expanded default values. + (let ((v (tramp-dissect-file-name file t)) + tramp-default-proxies-alist) ;; Run the command on the localname portion only unless we are in ;; completion mode. (tramp-make-tramp-file-name @@ -3985,8 +3985,10 @@ Let-bind it when necessary.") "Like `file-name-directory' for Tramp files." ;; Everything except the last filename thing is the directory. We ;; cannot apply `with-parsed-tramp-file-name', because this expands - ;; the remote file name parts. - (let ((v (tramp-dissect-file-name file t))) + ;; the remote file name parts. Suppress adding a hop to + ;; `tramp-default-proxies-alist' due to non-expanded default values. + (let ((v (tramp-dissect-file-name file t)) + tramp-default-proxies-alist) ;; Run the command on the localname portion only. If this returns ;; nil, mark also the localname part of `v' as nil. (tramp-make-tramp-file-name