[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 2dbc7e61f6 248/313: Extend bash-completion
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 2dbc7e61f6 248/313: Extend bash-completion-refresh to refresh everything, test it. |
Date: |
Sat, 3 Dec 2022 10:59:35 -0500 (EST) |
branch: elpa/bash-completion
commit 2dbc7e61f685178fdd0c1a0536e83f267955eabd
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
Extend bash-completion-refresh to refresh everything, test it.
---
bash-completion.el | 12 ++++++------
test/bash-completion-integration-test.el | 25 +++++++++++++++++++++++++
2 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/bash-completion.el b/bash-completion.el
index 156e97ebf5..70a60c5b4b 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -1350,18 +1350,18 @@ completion candidates."
;;;###autoload
(defun bash-completion-refresh ()
- "Refresh the completion table.
+ "Force a refresh the completion table.
This can be called after changing the completion table on BASH,
-with the builtin complete.
+or after starting a new BASH job.
This is only useful when `bash-completion-use-separate-processes'
is t."
(interactive)
- (let* ((process (bash-completion--get-process))
- (buffer (bash-completion--get-buffer process)))
- (bash-completion-send "complete -p" process)
- (process-put process 'complete-p (bash-completion-build-alist buffer))))
+ (let* ((process (bash-completion--get-process)))
+ (unless process
+ (error "Bash completion not available on current buffer."))
+ (bash-completion--setup-bash-common process)))
;;;###autoload
(defun bash-completion-reset ()
diff --git a/test/bash-completion-integration-test.el
b/test/bash-completion-integration-test.el
index c767129a2b..7a8326a655 100644
--- a/test/bash-completion-integration-test.el
+++ b/test/bash-completion-integration-test.el
@@ -108,6 +108,15 @@
(buffer-substring-no-properties
(line-beginning-position) (point)))
+(defun bash-completion_test-send (command)
+ "Execute COMMAND in a shell buffer."
+ (goto-char (point-max))
+ (delete-region (line-beginning-position) (line-end-position))
+ (insert command)
+ (comint-send-input)
+ (bash-completion--wait-for-regexp
+ (get-buffer-process (current-buffer)) comint-prompt-regexp 3.0))
+
(defun bash-completion_test-candidates (complete-me)
"Complete COMPLETE-ME and returns the candidates."
(goto-char (point-max))
@@ -356,4 +365,20 @@ for testing completion."
(should (equal "dummy 1 Yooo "
(bash-completion_test-complete "dummy 1 Y")))))
+(ert-deftest bash-completion-integration-refresh-test ()
+ (bash-completion_test-with-shell-harness
+ (concat ; .bashrc
+ "function _dummy { COMPREPLY=(Yooo); }\n"
+ "function dummy { echo $1; }\n"
+ "complete -F _dummy dummy\n")
+ nil ; use-separate-process
+ (should (equal "dummy 1 Yooo "
+ (bash-completion_test-complete "dummy 1 Y")))
+ (bash-completion_test-send "function _dummy2 { COMPREPLY=(Yaaa); }")
+ (bash-completion_test-send "complete -F _dummy2 dummy")
+ (bash-completion-refresh)
+ (should (equal "dummy 1 Yaaa "
+ (bash-completion_test-complete "dummy 1 Y")))))
+
+
;;; bash-completion-integration-test.el ends here
- [nongnu] elpa/bash-completion 4581a7823f 189/313: Bash 4: set COMP_TYPE and COMP_KEY to TAB, to let completion functions, (continued)
- [nongnu] elpa/bash-completion 4581a7823f 189/313: Bash 4: set COMP_TYPE and COMP_KEY to TAB, to let completion functions, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 802eb4e5a8 194/313: Set EMACS_BASH_COMPLETE even on remote (tramp) completion., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion fbdc78b877 198/313: Support compopt when using Bash 4., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f1bd3d528f 201/313: Improve some docstrings, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion fa49dbb382 209/313: Improve status code retrieval, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7822d84812 223/313: Added Cask with ert-runner to compile and run test., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 31a01859b2 227/313: Do not run tests under Emacs 24.1., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 21471cc542 228/313: Report result of running the test workflow on README.md., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 98a2a21be7 234/313: Provide a way of refreshing the completion table., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 4fcddf83c9 242/313: Make /etc/bash_completion scripts work with escaped spaces., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 2dbc7e61f6 248/313: Extend bash-completion-refresh to refresh everything, test it.,
ELPA Syncer <=
- [nongnu] elpa/bash-completion 04393bca0f 250/313: Apply filename post-processing even when prefix doesn't match., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 2a937b3763 255/313: Don't let Emacs post-filter completions built by bash., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion e95867c993 256/313: completion-table-with-cache captures and restore buffer and variables., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 747920fdbf 265/313: Avoid having to set BASH_COMPLETION., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f15176ee59 267/313: Fix to properly evaluate PROMPT_COMMAND after restoring it., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion b4ae893243 268/313: Test prompt and history manipulation, fix $? in prompt., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 20feaf909d 258/313: Fix markdown markup., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 8713edbb92 269/313: Mention that completion works with bash 5, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 4b80c75c43 272/313: Take current directory from shell when in single-process mode., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion ea5cc15b99 273/313: Let status code of compgen through when in single-process mode., ELPA Syncer, 2022/12/03