]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix quoted local file name parts in Tramp
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 3 May 2025 13:00:18 +0000 (15:00 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 08:48:32 +0000 (10:48 +0200)
* lisp/net/tramp.el (tramp-handle-directory-file-name):
* lisp/net/tramp-integration.el (tramp-rfn-eshadow-update-overlay):
Handle quoted local file name part.

(cherry picked from commit 28a276efe8744227e15a8077f6333974eda157bb)

lisp/net/tramp-integration.el
lisp/net/tramp.el

index a3f619c59253cdaba170c8898d835aad28d6e2a1..8569b1f30f4fec6f41deab81909479858c67ee2e 100644 (file)
@@ -58,8 +58,9 @@
 
 ;;; Fontification of `read-file-name':
 
-(defvar tramp-rfn-eshadow-overlay)
-(make-variable-buffer-local 'tramp-rfn-eshadow-overlay)
+;; An overlay covering the shadowed part of the filename (local to the
+;; minibuffer).
+(defvar-local tramp-rfn-eshadow-overlay nil)
 
 (defun tramp-rfn-eshadow-setup-minibuffer ()
   "Set up a minibuffer for `file-name-shadow-mode'.
@@ -103,7 +104,8 @@ been set up by `rfn-eshadow-setup-minibuffer'."
                   (minibuffer-prompt-end)))
          ;; We do not want to send any remote command.
          (non-essential t))
-      (when (tramp-tramp-file-p (buffer-substring end (point-max)))
+      (when (and (tramp-tramp-file-p (buffer-substring end (point-max)))
+                (not (file-name-quoted-p (buffer-substring end (point-max)))))
        (save-excursion
          (save-restriction
            (narrow-to-region
index 920a76ef8f215a62760f103bc78e965dfa5aff7b..58d6805f1b1f0aafcc2929c7220ac12130392140 100644 (file)
@@ -4109,6 +4109,7 @@ Let-bind it when necessary.")
   ;; Otherwise, remove any trailing slash from localname component.
   ;; Method, host, etc, are unchanged.
   (while (with-parsed-tramp-file-name directory nil
+          (setq localname (file-name-unquote localname))
           (and (length> localname 0)
                (eq (aref localname (1- (length localname))) ?/)
                (not (string= localname "/"))))
@@ -4197,8 +4198,8 @@ Let-bind it when necessary.")
     (eq (file-attribute-type (file-attributes (file-truename filename))) t)))
 
 (defun tramp-handle-file-equal-p (filename1 filename2)
-  "Like `file-equalp-p' for Tramp files."
-  ;; Native `file-equalp-p' calls `file-truename', which requires a
+  "Like `file-equal-p' for Tramp files."
+  ;; Native `file-equal-p' calls `file-truename', which requires a
   ;; remote connection.  This can be avoided, if FILENAME1 and
   ;; FILENAME2 are not located on the same remote host.
   (when (tramp-equal-remote