[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 8ca917f428 133/313: Stop escaping = in com
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 8ca917f428 133/313: Stop escaping = in completion. fixes #18 |
Date: |
Sat, 3 Dec 2022 10:59:24 -0500 (EST) |
branch: elpa/bash-completion
commit 8ca917f4287c133e27f02fc7f3eda47e16d9ab12
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
Stop escaping = in completion. fixes #18
Previously, bash-completion.el used shell-quote-argument from subr.el to
quote unsafe characters, which has a rather restrictive view of which
characters can be considered safe. This commit replaces
shell-quote-argument with custom code, and introduces
bash-completion-special-chars. This is, for now, the same regexp as in
shell-quote-argument, with = whitelisted.
Moving away from shell-quote-argument also avoids possible issues with
quoting on windows: since we know we're communicating with bash, there's
no reason to quote characters in a way that's platform-specific.
---
bash-completion-test.el | 4 ++++
bash-completion.el | 8 +++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/bash-completion-test.el b/bash-completion-test.el
index b400fd36d7..ac2241535b 100644
--- a/bash-completion-test.el
+++ b/bash-completion-test.el
@@ -547,6 +547,10 @@ garbage
(should (equal "\\(hello\\)"
(bash-completion-escape-candidate "(hello)" nil)))
+ ;; no quote
+ (should (equal "--hello="
+ (bash-completion-escape-candidate "--hello=" nil)))
+
;; single quote
(should (equal "He said: \"hello, '\\''you'\\''\""
(bash-completion-escape-candidate "He said: \"hello, 'you'\""
?')))
diff --git a/bash-completion.el b/bash-completion.el
index 43931dc19d..8a6baac957 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -224,6 +224,9 @@ completion in colon-separated values.")
(append bash-completion-wordbreaks-str nil)
"`bash-completion-wordbreaks-str' as a list of characters.")
+(defconst bash-completion-special-chars "[^-0-9a-zA-Z_./\n=]"
+ "Regexp of characters that must be escaped or quoted.")
+
(defconst bash-completion-wrapped-status
"\e\ebash-completion-wrapped-status=124\e\e"
"String output by __bash_complete_wrapper when the wrapped
@@ -760,7 +763,10 @@ Return a possibly escaped version of COMPLETION-CANDIDATE."
((zerop (length completion-candidate)) "")
((and (null open-quote)
(null (string-match "^['\"]" completion-candidate)))
- (shell-quote-argument completion-candidate))
+ (replace-regexp-in-string
+ "\n" "'\n'"
+ (replace-regexp-in-string
+ bash-completion-special-chars "\\\\\\&" completion-candidate)))
((eq ?' open-quote)
(replace-regexp-in-string "'" "'\\''" completion-candidate nil t))
((eq ?\" open-quote)
- [nongnu] elpa/bash-completion 6fb6bf5588 081/313: Mention ghardy bash version, (continued)
- [nongnu] elpa/bash-completion 6fb6bf5588 081/313: Mention ghardy bash version, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 33ed66e567 099/313: bash-completion-nospace option, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion cf42ed1057 101/313: add compatibility information for emacs 24.1.1 with OSX 10.7 / 10.8, ELPA Syncer, 2022/12/03
- [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 <=
- [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, 2022/12/03
- [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