[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 9eb026ae0b 025/313: fixed current director
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 9eb026ae0b 025/313: fixed current directory for adding slash, workaround for bash ~ expansion |
Date: |
Sat, 3 Dec 2022 10:59:12 -0500 (EST) |
branch: elpa/bash-completion
commit 9eb026ae0b84b3c2d21c61559fcf0d513c26751d
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
fixed current directory for adding slash, workaround for bash ~ expansion
---
bash-completion.el | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/bash-completion.el b/bash-completion.el
index d649d6c1d7..0686c015b7 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -160,15 +160,26 @@ calls compgen.
The result is a list of candidates, which might be empty."
(bash-completion-send (concat (bash-completion-generate-line line pos words
cword) " 2>/dev/null"))
- (with-current-buffer (bash-completion-buffer)
- (let ((bash-completion-prefix (nth cword words)))
- (mapcar 'bash-completion-fix (split-string (buffer-string) "\n" t)))))
+ (let ((bash-completion-prefix (nth cword words)))
+ (mapcar 'bash-completion-fix
+ (with-current-buffer (bash-completion-buffer)
+ (split-string (buffer-string) "\n" t)))))
(defun bash-completion-fix (str)
(bash-completion-addsuffix
- (if (bash-completion-starts-with str bash-completion-prefix)
- str
- (concat bash-completion-prefix str))))
+ (cond
+ ((bash-completion-starts-with str bash-completion-prefix)
+ str)
+ ;; bash expands the home directory automatic. this is confusing
+ ;; for comint-dynamic-simple-complete
+ ((and (bash-completion-starts-with bash-completion-prefix "~")
+ (bash-completion-starts-with str (expand-file-name "~")))
+ (concat "~" (substring str (length (expand-file-name "~")))))
+ ;; bash sometimes just prints whatever needs to be expanded,
+ ;; for example: "export PATH=<complete>". Prepend the old
+ ;; prefix to avoid confusing comint-dynamic-simple-complete
+ (t
+ (concat bash-completion-prefix str)))))
(defun bash-completion-starts-with (str prefix)
(let ((prefix-len (length prefix))
@@ -178,10 +189,12 @@ The result is a list of candidates, which might be empty."
(equal (substring str 0 prefix-len) prefix))))
(defun bash-completion-addsuffix (str)
+ (message "file=%s, accessible=%s" (expand-file-name str default-directory)
+ (file-accessible-directory-p (expand-file-name str
default-directory)))
(let ((end (substring str -1)))
(if (and (not (eq end " "))
(not (eq end "/"))
- (file-accessible-directory-p str))
+ (file-accessible-directory-p (expand-file-name str
default-directory)))
(concat str "/")
str)))
- [nongnu] elpa/bash-completion 3036ef0394 028/313: disable quote_readline to get good whitespace handling for bash 3.2 at least, (continued)
- [nongnu] elpa/bash-completion 3036ef0394 028/313: disable quote_readline to get good whitespace handling for bash 3.2 at least, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion ba83e81651 053/313: bash-completion-generate-line, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f7bfc68ea2 001/313: bash completion, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f5885ec87a 002/313: test case for bash-complete, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 208cb5ab76 007/313: Join, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 47a890dd72 010/313: launch process, send commands, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 53f2c5d30e 009/313: parse complete -p output, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 11e52fce6f 018/313: Fixed initialization, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c10cfef5b8 015/313: complex line split, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion b5c2fbf4a2 014/313: add hooks, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 9eb026ae0b 025/313: fixed current directory for adding slash, workaround for bash ~ expansion,
ELPA Syncer <=
- [nongnu] elpa/bash-completion 02d1acf260 030/313: wordbreaks, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 5931a2ba43 037/313: completion-fix, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion a78fd6b587 044/313: turn off mailwarn and checkjobs, continue if this failed, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 0ffaad3ef0 035/313: wordbreak-split, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 80cd654c35 043/313: turn off mailwarn and checkjobs, continue if this failed, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 1c6b2efb67 040/313: enormous test, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion fc96b621e2 034/313: pass all tests in bash-completion, new test for -send, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion e77c841dac 107/313: Merge pull request #3 from seanmcl/master, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 062acfab3e 052/313: updated documentation, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 75e5de1494 066/313: fix initial completion, ELPA Syncer, 2022/12/03