[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 19d4fec42f 280/313: Use && instead of ; af
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 19d4fec42f 280/313: Use && instead of ; after cd, so completion fails if cd fails. |
Date: |
Sat, 3 Dec 2022 10:59:37 -0500 (EST) |
branch: elpa/bash-completion
commit 19d4fec42ff609780e301086f5c7867c435bb5c9
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
Use && instead of ; after cd, so completion fails if cd fails.
This avoids running completion in the wrong directory, when in
multi-process mode.
---
bash-completion.el | 2 +-
test/bash-completion-test.el | 22 +++++++++++-----------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/bash-completion.el b/bash-completion.el
index 3feff28b0c..425cb8564a 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -1251,7 +1251,7 @@ Return a bash command-line for going to default-directory
or \"\"."
(if dir
(concat "cd >/dev/null 2>&1 "
(bash-completion-quote (bash-completion--expand-file-name dir
t))
- " ; ")
+ " && ")
"")))
(defun bash-completion-build-alist (buffer)
diff --git a/test/bash-completion-test.el b/test/bash-completion-test.el
index 593d6424b2..a7c0b1618e 100644
--- a/test/bash-completion-test.el
+++ b/test/bash-completion-test.el
@@ -376,7 +376,7 @@ garbage
(bash-completion-use-separate-processes t))
(should
(equal (concat "cd >/dev/null 2>&1 /test"
- " ; compgen -o default -- worl 2>/dev/null")
+ " && compgen -o default -- worl 2>/dev/null")
(bash-completion-generate-line
(bash-completion--make
:line "hello worl"
@@ -388,7 +388,7 @@ garbage
;; custom completion no function or command
(should (equal
- "cd >/dev/null 2>&1 /test ; compgen -A -G '*.txt' -- worl
2>/dev/null"
+ "cd >/dev/null 2>&1 /test && compgen -A -G '*.txt' -- worl
2>/dev/null"
(bash-completion-generate-line
(bash-completion--make
:line "zorg worl"
@@ -402,7 +402,7 @@ garbage
;; custom completion function
(should (equal
(concat
- "cd >/dev/null 2>&1 /test ; "
+ "cd >/dev/null 2>&1 /test && "
"__EMACS_COMPLETE_WRAPPER='COMP_LINE='\\''zorg blah worl'\\''; "
"COMP_POINT=12; COMP_CWORD=2; "
"COMP_WORDS=( zorg blah worl ); "
@@ -421,7 +421,7 @@ garbage
;; custom completion command
(should (equal
(concat
- "cd >/dev/null 2>&1 /test ; "
+ "cd >/dev/null 2>&1 /test && "
"__EMACS_COMPLETE_WRAPPER='COMP_LINE='\\''zorg worl'\\''; "
"COMP_POINT=7; "
"COMP_CWORD=1; "
@@ -440,7 +440,7 @@ garbage
;; command completion
(should (equal
- "cd >/dev/null 2>&1 /test ; compgen -b -c -a -A function -- worl
2>/dev/null"
+ "cd >/dev/null 2>&1 /test && compgen -b -c -a -A function -- worl
2>/dev/null"
(bash-completion-generate-line
(bash-completion--make
:line "worl"
@@ -552,13 +552,13 @@ Return (const return-value new-buffer-content)"
(bash-completion-cd-command-prefix))))
;; current dir
- (should (equal "cd >/dev/null 2>&1 /tmp/x ; "
+ (should (equal "cd >/dev/null 2>&1 /tmp/x && "
(let ((default-directory "/tmp/x"))
(bash-completion-cd-command-prefix))))
;; expand tilde
(should (equal
- (concat "cd >/dev/null 2>&1 " (expand-file-name "~/x") " ; ")
+ (concat "cd >/dev/null 2>&1 " (expand-file-name "~/x") " && ")
(let ((default-directory "~/x"))
(bash-completion-cd-command-prefix)))))
@@ -978,7 +978,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-simple-dynamic-table-test ()
@@ -1098,7 +1098,7 @@ before calling
`bash-completion-dynamic-complete-nocomint'.
(nth 2(bash-completion-dynamic-complete-nocomint 3 (point)))))
(should (equal
(concat
- "cd >/dev/null 2>&1 /tmp/test ; "
+ "cd >/dev/null 2>&1 /tmp/test && "
"compgen -o default -- 'Documents/Modes d'\\''emplois/'
2>/dev/null")
(pop --captured-commands)))))
@@ -1133,7 +1133,7 @@ before calling
`bash-completion-dynamic-complete-nocomint'.
(should (equal
'("bin/" "bind")
(nth 2 (bash-completion-dynamic-complete-nocomint 3 (point)))))
- (should (equal (concat "cd >/dev/null 2>&1 /tmp/test ; "
+ (should (equal (concat "cd >/dev/null 2>&1 /tmp/test && "
"compgen -b -c -a -A function -- b 2>/dev/null")
(pop --captured-commands)))))
@@ -1144,7 +1144,7 @@ before calling
`bash-completion-dynamic-complete-nocomint'.
(should (equal
'("some\\ command ")
(nth 2 (bash-completion-dynamic-complete-nocomint 3 (point)))))
- (should (equal (concat "cd >/dev/null 2>&1 /tmp/test ; "
+ (should (equal (concat "cd >/dev/null 2>&1 /tmp/test && "
"compgen -b -c -a -A function -- 'some c'
2>/dev/null")
(pop --captured-commands)))))
- [nongnu] elpa/bash-completion cad904abfd 247/313: Redefine quote_readline from setup-bash-common., (continued)
- [nongnu] elpa/bash-completion cad904abfd 247/313: Redefine quote_readline from setup-bash-common., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 5447034cdc 251/313: Respect completion-ignore-case setting from .inputrc., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 42630fe6cc 254/313: Fix test case to cover substring completion., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 8f33a2aac4 257/313: Better document calling bash-completion from completion-at-point., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 96d2cef799 259/313: Prepare for a 3.0 release., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 4aafffe76a 260/313: Create CONTRIBUTING.md, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 2b9eba14fa 261/313: Update README.md, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 79ce50bec9 262/313: Update README.md title, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 5e623ac270 275/313: Revert "Add test cases for TRAMP shell.", ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 702859f319 278/313: Cleanup strings containing bash commands., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 19d4fec42f 280/313: Use && instead of ; after cd, so completion fails if cd fails.,
ELPA Syncer <=
- [nongnu] elpa/bash-completion c584d4936b 281/313: Explicitly ignore error from the history command., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion de033933bd 282/313: Chain function definitions with && during setup., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion e24a596631 283/313: Make integration tests stabler., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 51c7770758 284/313: Fix and update README.md, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c6decb1d6c 285/313: Avoid escaping all non-ASCII characters., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 4c216c4eea 286/313: Add an integration test to cover multiple completion results., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 8f877dc2ce 287/313: Let bash compute COMP_POINT, always at the end of COMP_LINE., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 377969faa7 288/313: Fix typos in README.md, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 72e9fce93d 291/313: Properly apply filter passed to the dynamic completion function., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 35d38fd3dc 295/313: Workaround for output containing \r\n instead of \n., ELPA Syncer, 2022/12/03