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

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

[nongnu] elpa/bash-completion 7186a18cad 012/313: Integrated into comm


From: ELPA Syncer
Subject: [nongnu] elpa/bash-completion 7186a18cad 012/313: Integrated into comm
Date: Sat, 3 Dec 2022 10:59:11 -0500 (EST)

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

    Integrated into comm
---
 bash-complete.el      | 11 +++++++----
 bash-complete_test.el | 14 +++++++-------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/bash-complete.el b/bash-complete.el
index 3f9292f379..0a2547d2f3 100644
--- a/bash-complete.el
+++ b/bash-complete.el
@@ -52,7 +52,9 @@ Call bash to do the completion."
 (defun bash-complete-quote (word)
   (if (string-match "^[a-zA-Z0-9_.-]*$" word)
       word
-    (concat "'" (replace-regexp-in-string "'" "\\\'" word :literal t) "'")))
+    (concat "'"
+           (replace-regexp-in-string "'" "'\\''" word :literal t)
+           "'")))
 
 (defun bash-complete-split (start end pos)
   "Split LINE like bash would do, keep track of current word at POS.
@@ -122,8 +124,9 @@ completion environment (COMP_LINE, COMP_POINT, COMP_WORDS, 
COMP_CWORD) and
 calls compgen.
 
 The result is a list of candidates, which might be empty."
-
-  )
+  (bash-complete-send (concat (bash-complete-generate-line line pos words 
cword) " 2>/dev/null"))
+  (with-current-buffer (bash-complete-buffer)
+    (split-string (buffer-string) "\n" t)))
 
 (defun bash-complete-require-process ()
   ;; TODO(szermatt): if this fails, kill process and complain
@@ -136,8 +139,8 @@ The result is a list of candidates, which might be empty."
           "--noediting"))
     (set-process-query-on-exit-flag bash-complete-process nil)
     (bash-complete-send "PS1='\v'")
+    (bash-complete-send "function __bash_complete_wrapper { eval 
$__BASH_COMPLETE_WRAPPER; }")
     (bash-complete-send "complete -p")
-    (bash-complete-send "function __bash_complete_wrapper { eval 
$__BASH_COMPLETE_WRAPPER }")
     (bash-complete-build-alist (process-buffer bash-complete-process)))
   bash-complete-process)
 
diff --git a/bash-complete_test.el b/bash-complete_test.el
index 41b93c7356..3969b7303c 100644
--- a/bash-complete_test.el
+++ b/bash-complete_test.el
@@ -34,7 +34,7 @@
 
      ("bash-complete-join escape quote"
       (bash-complete-join '("a" "hel'lo" "world" "b" "c"))
-      "a 'hel\\'lo' world b c")
+      "a 'hel'\\''lo' world b c")
 
      ("bash-complete-join escape space"
       (bash-complete-join '("a" "hello world" "b" "c"))
@@ -72,7 +72,7 @@
 
      ("bash-complete-split single quotes"
       (sz-testutils-with-buffer
-       '("a 'hello world' b c")
+       '("a \"hello world\" b c")
        (bash-complete-split 1 (line-end-position) 0))
       '(nil . ("a" "hello world" "b" "c")))
 
@@ -159,13 +159,13 @@ garbage
       (bash-complete-quote "hello")
       "hello")
 
-     ("bash-complete-quote not necessary"
+     ("bash-complete-quote space"
       (bash-complete-quote "hello world")
       "'hello world'")
 
-     ("bash-complete-quote not necessary"
+     ("bash-complete-quote quote"
       (bash-complete-quote "hell'o")
-      "'hell\\'o'")
+      "'hell'\\''o'")
 
      ("bash-complete-generate-line no custom completion"
       (let ((bash-complete-alist nil))
@@ -180,12 +180,12 @@ garbage
      ("bash-complete-generate-line custom completion function"
       (let ((bash-complete-alist '(("zorg" . ("-F" "__zorg")))))
        (bash-complete-generate-line "zorg worl" 7 '("zorg" "worl") 1))
-      "__BASH_COMPLETE_WRAPPER='COMP_LINE=\\'zorg worl\\'; COMP_POS=7; 
COMP_CWORD=1; COMP_WORDS=( zorg worl ); __zorg \"$@\"' compgen -F 
__bash_complete_wrapper worl")
+      "__BASH_COMPLETE_WRAPPER='COMP_LINE='\\''zorg worl'\\''; COMP_POS=7; 
COMP_CWORD=1; COMP_WORDS=( zorg worl ); __zorg \"$@\"' compgen -F 
__bash_complete_wrapper worl")
 
      ("bash-complete-generate-line custom completion command"
       (let ((bash-complete-alist '(("zorg" . ("-C" "__zorg")))))
        (bash-complete-generate-line "zorg worl" 7 '("zorg" "worl") 1))
-      "__BASH_COMPLETE_WRAPPER='COMP_LINE=\\'zorg worl\\'; COMP_POS=7; 
COMP_CWORD=1; COMP_WORDS=( zorg worl ); __zorg \"$@\"' compgen -F 
__bash_complete_wrapper worl")
+      "__BASH_COMPLETE_WRAPPER='COMP_LINE='\\''zorg worl'\\''; COMP_POS=7; 
COMP_CWORD=1; COMP_WORDS=( zorg worl ); __zorg \"$@\"' compgen -F 
__bash_complete_wrapper worl")
 
       )))
 



reply via email to

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