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

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

[nongnu] elpa/bash-completion 61592a1ce1 218/313: bash-completion.el (ba


From: ELPA Syncer
Subject: [nongnu] elpa/bash-completion 61592a1ce1 218/313: bash-completion.el (bash-completion-quote): Add case for empty string (#37)
Date: Sat, 3 Dec 2022 10:59:32 -0500 (EST)

branch: elpa/bash-completion
commit 61592a1ce11efdff1d18bb7675c651a8f914c10d
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Stephane Zermatten <szermatt@gmx.net>

    bash-completion.el (bash-completion-quote): Add case for empty string (#37)
---
 bash-completion.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/bash-completion.el b/bash-completion.el
index eb93f99876..b947a6083c 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -254,7 +254,7 @@ Bash processes")
   open-quote     ; quote open at stub end: nil, ?' or ?\""
   compgen-args   ; compgen arguments for this command (list of strings)
   wordbreaks     ; value of COMP_WORDBREAKS active for this completion
-  compopt        ; options forced with compopt nil or `(nospace . ,bool) 
+  compopt        ; options forced with compopt nil or `(nospace . ,bool)
 )
 
 (defun bash-completion--type (comp)
@@ -431,11 +431,15 @@ Return one string containing WORDS."
 
 If WORD contains characters that aren't known to be harmless, this
 functions adds single quotes around it and return the result."
-  (if (string-match "^[a-zA-Z0-9_./-]*$" word)
-      word
-    (concat "'"
-           (replace-regexp-in-string "'" "'\\''" word nil t)
-           "'")))
+  (cond
+    ((string= "" word)
+     "''")
+    ((string-match "^[a-zA-Z0-9_./-]*$" word)
+     word)
+    (t
+     (concat "'"
+             (replace-regexp-in-string "'" "'\\''" word nil t)
+             "'"))))
 
 (defun bash-completion--parse (comp-start comp-pos wordbreaks 
bash-major-version)
   "Process a command line split into TOKENS that end at POS.
@@ -1081,7 +1085,7 @@ The returned alist is a sligthly parsed version of the 
output of
                          (line-end-position)))))
             (when (string= "complete" (car words))
               (if (member "-D" (cdr words))
-                  ;; default completion 
+                  ;; default completion
                   (push (cons nil (delete "-D" (cdr words))) alist)
                 ;; normal completion
                 (let* ((reverse-wordsrest (nreverse (cdr words)))



reply via email to

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