branch: elpa/vcomplete commit 84c888747e99c7ba2097d452318bbfc6ba80bde4 Author: Daniel Semyonov <dan...@dsemy.com> Commit: Daniel Semyonov <dan...@dsemy.com>
Reset the '*Completions*' buffer when 'vcomplete-mode' is disabled * vcomplete.el (vcomplete--reset-completions): New function. (vcomplete-mode): Call 'vcomplete--reset-completions' when disabling. --- NEWS | 3 +++ vcomplete.el | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/NEWS b/NEWS index 769835c67f..e2125183db 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,9 @@ See the end of the file for an explanation of the versioning scheme. * 1.2 (in development) +** Fix the completion list window still highlighting completions in some +cases after 'vcomplete-mode' is disabled. + ** Improve Embark integration. Fix Embark 'non-edit commands' not immediately exiting when 'vcomplete-auto-update' is t. diff --git a/vcomplete.el b/vcomplete.el index 26b1e8a6d7..d967fdfb0e 100644 --- a/vcomplete.el +++ b/vcomplete.el @@ -250,6 +250,13 @@ With prefix argument N, move N items (negative N means move forward)." (add-hook 'post-command-hook #'vcomplete--highlight-completion-at-point nil t)) +(defun vcomplete--reset-completions () + "Stop highlighting the completion at point in the `*Completions*' buffer." + (when-let ((buf (get-buffer "*Completions*"))) + (with-current-buffer buf + (remove-hook 'post-command-hook + #'vcomplete--highlight-completion-at-point t)))) + (defun vcomplete--setup-minibuffer () "Setup visual completions for the minibuffer." (when minibuffer-completion-table ; Ensure completion is in progress. @@ -297,6 +304,7 @@ The following bindings are available during completion: (add-hook 'minibuffer-setup-hook #'vcomplete--setup-minibuffer) (add-hook 'completion-in-region-mode-hook #'vcomplete--setup-in-region)) (remove-hook 'completion-list-mode-hook #'vcomplete--setup-completions) + (vcomplete--reset-completions) (remove-hook 'minibuffer-setup-hook #'vcomplete--setup-minibuffer) (remove-hook 'completion-in-region-mode-hook #'vcomplete--setup-in-region)))