[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 0d360a45cd 017/313: fixed test case
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 0d360a45cd 017/313: fixed test case |
Date: |
Sat, 3 Dec 2022 10:59:11 -0500 (EST) |
branch: elpa/bash-completion
commit 0d360a45cd51ef882cb46a824a61dd77cd8a5efc
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
fixed test case
---
bash-complete.el | 16 ++++++++--------
bash-complete_test.el | 16 ++++++++--------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/bash-complete.el b/bash-complete.el
index 2cec4cec64..3946ffcff9 100644
--- a/bash-complete.el
+++ b/bash-complete.el
@@ -1,7 +1,7 @@
(require 'comint)
-(defvar bash-complete-command "bash"
+(defvar bash-complete-command "bash"
"Command-line to execute bash")
(defvar bash-complete-process-timeout 2.5)
@@ -54,7 +54,7 @@ Call bash to do the completion."
(setq stub (nth cword words)))
(comint-dynamic-simple-complete
stub
- (bash-complete-comm
+ (bash-complete-comm default-directory
line (- pos start) words cword))))
(defun bash-complete-line-beginning-position (&optional start)
@@ -75,7 +75,7 @@ Call bash to do the completion."
""))
(defun bash-complete-quote (word)
- (if (string-match "^[a-zA-Z0-9_.-]*$" word)
+ (if (string-match "^[a-zA-Z0-9_./-]*$" word)
word
(concat "'"
(replace-regexp-in-string "'" "'\\''" word :literal t)
@@ -141,15 +141,15 @@ at POS, the current word: ( (word1 word2 ...) . wordnum )"
(concat "^ \t\n\r" (char-to-string quote))
"^ \t\n\r'\""))
-(defun bash-complete-comm (line pos words cword)
- "Set LINE, POS, WORDS and CWORD, call bash completion, return the result.
+(defun bash-complete-comm (dir line pos words cword)
+ "Set DIR, LINE, POS, WORDS and CWORD, call bash completion, return the
result.
This function starts a separate bash process if necessary, sets up the
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"))
+ (bash-complete-send (concat (bash-complete-generate-line dir line pos words
cword) " 2>/dev/null"))
(with-current-buffer (bash-complete-buffer)
(mapcar 'bash-complete-trim (split-string (buffer-string) "\n" t))))
@@ -198,9 +198,9 @@ The result is a list of candidates, which might be empty."
(kill-process process)
(error nil))))))))
-(defun bash-complete-generate-line (line pos words cword)
+(defun bash-complete-generate-line (dir line pos words cword)
(concat
- (if default-directory (concat "cd " (bash-complete-quote (expand-file-name
default-directory)) " ; ") "")
+ (if default-directory (concat "cd " (bash-complete-quote (expand-file-name
dir)) " ; ") "")
(let* ( (command (file-name-nondirectory (car words)))
(compgen-args (cdr (assoc command bash-complete-alist))) )
(if (not compgen-args)
diff --git a/bash-complete_test.el b/bash-complete_test.el
index 64e21ba716..d5dfb32955 100644
--- a/bash-complete_test.el
+++ b/bash-complete_test.el
@@ -169,23 +169,23 @@ garbage
("bash-complete-generate-line no custom completion"
(let ((bash-complete-alist nil))
- (bash-complete-generate-line "hello worl" 7 '("hello" "worl") 1))
- "compgen -o default worl")
+ (bash-complete-generate-line "~/test" "hello worl" 7 '("hello" "worl")
1))
+ (concat "cd " (expand-file-name "~/test") " ; compgen -o default worl"))
("bash-complete-generate-line custom completion no function or command"
(let ((bash-complete-alist '(("zorg" . ("-A" "-G" "*.txt")))))
- (bash-complete-generate-line "zorg worl" 7 '("zorg" "worl") 1))
- "compgen -A -G '*.txt' worl")
+ (bash-complete-generate-line "/test" "zorg worl" 7 '("zorg" "worl") 1))
+ "cd /test ; compgen -A -G '*.txt' -- worl")
("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-generate-line "/test" "zorg worl" 7 '("zorg" "worl") 1))
+ "cd /test ; __BASH_COMPLETE_WRAPPER='COMP_LINE='\\''zorg worl'\\'';
COMP_POINT=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-generate-line "/test" "zorg worl" 7 '("zorg" "worl") 1))
+ "cd /test ; __BASH_COMPLETE_WRAPPER='COMP_LINE='\\''zorg worl'\\'';
COMP_POINT=7; COMP_CWORD=1; COMP_WORDS=( zorg worl ); __zorg \"$@\"' compgen -F
__bash_complete_wrapper -- worl")
("bash-complete-trim"
(mapcar 'bash-complete-trim '(" hello " " world " "x"))
- [nongnu] elpa/bash-completion 583d1dde61 151/313: Remove usage of seq-position with a custom implementation., (continued)
- [nongnu] elpa/bash-completion 583d1dde61 151/313: Remove usage of seq-position with a custom implementation., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 664452aca2 157/313: Merge pull request #22 from kfogel/21-fix-completion-re-21149fdc, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion ad8d72c626 162/313: README nit pick ; ), ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c494a89070 168/313: Run tests under Emacs 24.1: alias letf to cl-letf., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f523a290a6 169/313: Make the integration tests run on Emacs 24.1., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion bbff4fa527 172/313: Merge branch 'master' of github.com:szermatt/emacs-bash-completion, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion b307dc24c3 005/313: keep cword, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion a79137cc86 004/313: escaped quotes, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 581864111e 039/313: integration test harness, process buffer cleanup, hidden buffer, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3e1481741c 031/313: remove messages, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 0d360a45cd 017/313: fixed test case,
ELPA Syncer <=
- [nongnu] elpa/bash-completion c28492a749 036/313: wordbreak before and after, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 8b02aafc67 046/313: separators, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 2390d5cdf3 061/313: more commends and documentation; still need a commentary section, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c0f7c20a6b 094/313: added license and missing test dependency, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion a2d322fb79 054/313: Added customization group, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 983f5c28e9 106/313: Merge pull request #2 from frankpzh/patch-1, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 9f02a62609 049/313: re-enabled parse-line cursor at the beginning/in the middle tests, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3ec615a4ef 077/313: added id, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f1d8d73b42 072/313: changed comment, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 2d6ad3980a 062/313: fixes for emacs 22, ELPA Syncer, 2022/12/03