emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 5d8bb89: Fix expand-file-name on DOS_NT systems whe


From: Eli Zaretskii
Subject: [Emacs-diffs] master 5d8bb89: Fix expand-file-name on DOS_NT systems when /: escaping is used
Date: Tue, 27 Dec 2016 08:13:25 +0000 (UTC)

branch: master
commit 5d8bb89f0fa7d5f2824a914ce2b7c3841112c7a1
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix expand-file-name on DOS_NT systems when /: escaping is used
    
    * src/fileio.c (Fexpand_file_name) [DOS_NT]: Don't expand "~" in
    file names escaped by "/:".  Don't recursively expand
    default-directory escaped with "/:" which is not followed by a
    drive spec.  (Bug#25183)
---
 src/fileio.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/fileio.c b/src/fileio.c
index 3ba85b2..1a744e0 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -884,6 +884,11 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
        /* Detect MSDOS file names with drive specifiers.  */
        && ! (IS_DRIVE (o[0]) && IS_DEVICE_SEP (o[1])
              && IS_DIRECTORY_SEP (o[2]))
+       /* Detect escaped file names without drive spec after "/:".
+          These should not be recursively expanded, to avoid
+          including the default directory twice in the expanded
+          result.  */
+       && ! (o[0] == '/' && o[1] == ':')
 #ifdef WINDOWSNT
        /* Detect Windows file names in UNC format.  */
        && ! (IS_DIRECTORY_SEP (o[0]) && IS_DIRECTORY_SEP (o[1]))
@@ -1064,7 +1069,11 @@ filesystem tree, not (expand-file-name ".."  dirname).  
*/)
 
   newdir = newdirlim = 0;
 
-  if (nm[0] == '~')            /* prefix ~ */
+  if (nm[0] == '~'             /* prefix ~ */
+#ifdef DOS_NT
+    && !is_escaped             /* don't expand ~ in escaped file names */
+#endif
+      )
     {
       if (IS_DIRECTORY_SEP (nm[1])
          || nm[1] == 0)        /* ~ by itself */



reply via email to

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