emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/bash-completion 319886faa9 138/313: Add / after directory


From: ELPA Syncer
Subject: [nongnu] elpa/bash-completion 319886faa9 138/313: Add / after directory names - even if they contain spaces or special
Date: Sat, 3 Dec 2022 10:59:24 -0500 (EST)

branch: elpa/bash-completion
commit 319886faa901d4ca97aa58e471e659340f453d16
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>

    Add / after directory names - even if they contain spaces or special
    characters, escaped with \\.
    
    When completing filenames with spaces, emacs bash completion escapes
    spaces and other special characters with backslashes. So when
    completing:
      ls ~/Documents/My
    to the directory "My Books", emacs bash completion completes it to:
      ls ~/Documents/My\\ Book/
    with this fix, the / is there. Without it, emacs bash completion would
    look for a directory called "My\\ Book" - fail to find it and not add
    the backslash.
---
 bash-completion.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bash-completion.el b/bash-completion.el
index a58bf9486f..cf9ed50d6f 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -801,7 +801,10 @@ This function looks for a directory called STR relative to 
the
 buffer-local variable default-directory. If it exists, it returns
 \(concat STR \"/\"). Otherwise it retruns STR."
   (if (and (null (string-match bash-completion-known-suffixes-regexp str))
-          (file-accessible-directory-p (expand-file-name str 
default-directory)))
+          (file-accessible-directory-p
+            (expand-file-name
+             (replace-regexp-in-string "\\(\\\\\\)\\(.\\)" "\\2" str)
+             default-directory)))
        (concat str "/")
     str))
 



reply via email to

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