[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 44bc73449e 144/313: Fixes strange behavior
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 44bc73449e 144/313: Fixes strange behavior when completing --. |
Date: |
Sat, 3 Dec 2022 10:59:25 -0500 (EST) |
branch: elpa/bash-completion
commit 44bc73449e0a558118dfd58c22303c14d631d1ba
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
Fixes strange behavior when completing --.
Completing -- in commands where no completion has been defined used to
default to file completion, so for example:
ls --<complete>
would complete to
ls --bar
if there was a file bar in the current directory.
This is because the string to be completed was passed to compgen,
and when compgen sees --, it just disables parsing of further
parameters. It didn't happen when using custom completion, because
bash-completion.el already passed -- in this case.
This change adds the missing -- for default and command completion, to
avoid issue when completing -- or files starting with -.
Mentioned in issue #13
---
bash-completion-test.el | 8 ++++----
bash-completion.el | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/bash-completion-test.el b/bash-completion-test.el
index 7475c2d920..c65414973d 100644
--- a/bash-completion-test.el
+++ b/bash-completion-test.el
@@ -321,7 +321,7 @@ garbage
;; no custom completion
(should
(equal (concat "cd >/dev/null 2>&1 " (expand-file-name "~/test")
- " ; compgen -o default worl 2>/dev/null")
+ " ; compgen -o default -- worl 2>/dev/null")
(let ((bash-completion-alist nil)
(default-directory "~/test"))
(bash-completion-generate-line "hello worl" 7 '("hello" "worl") 1
nil))))
@@ -356,7 +356,7 @@ garbage
;; ignore completion function
(should (equal
- "cd >/dev/null 2>&1 /test ; compgen -o default worl 2>/dev/null"
+ "cd >/dev/null 2>&1 /test ; compgen -o default -- worl 2>/dev/null"
(let ((bash-completion-alist '((nil . ("-F" "__zorg"))))
(default-directory "/test"))
(bash-completion-generate-line "zorg worl" 7 '("zorg" "worl") 1
nil)))))
@@ -733,7 +733,7 @@ before calling `bash-completion-dynamic-complete-nocomint'.
(should (equal
(list 7 9 '("hell" "hello1" "hello2"))
(bash-completion-dynamic-complete-nocomint 3 (point))))
- (should (equal "cd >/dev/null 2>&1 /tmp/test ; compgen -o default he
2>/dev/null"
+ (should (equal "cd >/dev/null 2>&1 /tmp/test ; compgen -o default -- he
2>/dev/null"
(pop --captured-commands)))))
(ert-deftest bash-completion-single-completion-test ()
@@ -837,7 +837,7 @@ before calling `bash-completion-dynamic-complete-nocomint'.
'("bin/" "bind ")
(nth 2 (bash-completion-dynamic-complete-nocomint 3 (point)))))
(should (equal (concat "cd >/dev/null 2>&1 /tmp/test ; "
- "compgen -b -c -a -A function b 2>/dev/null")
+ "compgen -b -c -a -A function -- b 2>/dev/null")
(pop --captured-commands)))))
;;; bash-completion_test.el ends here
diff --git a/bash-completion.el b/bash-completion.el
index 2e0b470549..0f06fce4b2 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -1092,12 +1092,12 @@ completion candidates."
((= cword 0)
;; a command. let bash expand builtins, aliases and functions
(setq completion-type 'command)
- (setq commandline (concat "compgen -b -c -a -A function " stub)))
+ (setq commandline (concat "compgen -b -c -a -A function -- " stub)))
((not compgen-args)
;; no completion configured for this command
(setq completion-type 'default)
- (setq commandline (bash-completion-join (list "compgen" "-o" "default"
stub))))
+ (setq commandline (concat "compgen -o default -- " stub)))
((or (member "-F" compgen-args) (member "-C" compgen-args))
;; custom completion with a function of command
- [nongnu] elpa/bash-completion f9903d4bd4 079/313: ran checkdoc again, re-ran integration tests, (continued)
- [nongnu] elpa/bash-completion f9903d4bd4 079/313: ran checkdoc again, re-ran integration tests, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion bab4cf6e8d 109/313: Merge remote-tracking branch 'origin/master' into complete_D, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion dce43a54c5 119/313: Update comment in bash-completion-test, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 5209200f3b 120/313: Using cl-letf instead of flet., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 9588a9c0dd 125/313: Updated README, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c5f2b2756f 129/313: Define sz-testutils as a global variable., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f085c41d8d 131/313: Add defcustom for bash-completion-args, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 8ca917f428 133/313: Stop escaping = in completion. fixes #18, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 319886faa9 138/313: Add / after directory names - even if they contain spaces or special, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f2ea2b65df 141/313: Detect directories when expanding commands and add a slash instead of a, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 44bc73449e 144/313: Fixes strange behavior when completing --.,
ELPA Syncer <=
- [nongnu] elpa/bash-completion b4757884b0 145/313: Expand the tests to better cover wordbreak and command argument, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 6ab1fe406b 148/313: Always quote the stub before passing it to compgen., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion a789093cd3 155/313: Run tests on older versions of Emacs., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 5e05365dc8 153/313: Cleanup tests, split them into unit and integration tests., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 09c93ffbdb 165/313: Explicitly disable support for Emacs version older than 24.1., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 62c6567af6 158/313: Complete argument rename, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 5eb85cf1fc 166/313: Remove obsolete functions bash-completion-dynamic-complete-0 and, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 9b94818f88 167/313: Remove support for pre-Emacs24.1 backward compatibility., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 912e1e8153 170/313: Add an option to disable default Readline completion when no matches are found (#29), ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 959e27dae3 171/313: Add remote shell support, ELPA Syncer, 2022/12/03