emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 7553e0f: Quote file-truename symlink to "../foo:bar


From: Paul Eggert
Subject: [Emacs-diffs] master 7553e0f: Quote file-truename symlink to "../foo:bar:"
Date: Wed, 30 Aug 2017 17:47:01 -0400 (EDT)

branch: master
commit 7553e0f490e1f9a51c330816f7372da735091e8f
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Quote file-truename symlink to "../foo:bar:"
    
    Problem reported by Michael Albinus (Bug#28264#19).
    * lisp/files.el (files--splice-dirname-file): Fix bug where
    a relative symlink to "../foo:bar:" did not quote the result.
---
 lisp/files.el | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index 8cec3d4..43aec81 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1155,19 +1155,19 @@ names beginning with `~'."
 
 (defun files--splice-dirname-file (dirname file)
   "Splice DIRNAME to FILE like the operating system would.
-If FILENAME is relative, return DIRNAME concatenated to FILE.
+If FILE is relative, return DIRNAME concatenated to FILE.
 Otherwise return FILE, quoted as needed if DIRNAME and FILE have
 different handlers; although this quoting is dubious if DIRNAME
 is magic, it is not clear what would be better.  This function
 differs from `expand-file-name' in that DIRNAME must be a
 directory name and leading `~' and `/:' are not special in FILE."
-  (if (files--name-absolute-system-p file)
-      (if (eq (find-file-name-handler dirname 'file-symlink-p)
-             (find-file-name-handler file 'file-symlink-p))
-         file
-        ;; If `file' is remote, we want to quote it at the beginning.
-        (let (file-name-handler-alist) (file-name-quote file)))
-    (concat dirname file)))
+  (let ((unquoted (if (files--name-absolute-system-p file)
+                     file
+                   (concat dirname file))))
+    (if (eq (find-file-name-handler dirname 'file-symlink-p)
+           (find-file-name-handler unquoted 'file-symlink-p))
+       unquoted
+      (let (file-name-handler-alist) (file-name-quote unquoted)))))
 
 (defun file-truename (filename &optional counter prev-dirs)
   "Return the truename of FILENAME.



reply via email to

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