branch: elpa/bash-completion
commit 98a2a21be772283fd850416671102d8518b2ef7a
Author: Stephane Zermatten <[email protected]>
Commit: Stephane Zermatten <[email protected]>
Provide a way of refreshing the completion table.
With bash-completion-use-separate-processes set to t, it is possible
to change the set of completion on bash, and these change need to be
reflected in the internal completion table kept on the Emacs side.
---
bash-completion.el | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/bash-completion.el b/bash-completion.el
index f50dd7fdc4..4cac5a4932 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -1280,6 +1280,21 @@ completion candidates."
(t (error "Unsupported completion type: %s" completion-type)))
" 2>/dev/null")))
+;;;###autoload
+(defun bash-completion-refresh ()
+ "Refresh the completion table.
+
+This can be called after changing the completion table on BASH,
+with the builtin complete.
+
+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))))
+
;;;###autoload
(defun bash-completion-reset ()
"Force the next completion command to start with a fresh BASH process.