emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/vcomplete 84c888747e 81/91: Reset the '*Completions*' buff


From: ELPA Syncer
Subject: [nongnu] elpa/vcomplete 84c888747e 81/91: Reset the '*Completions*' buffer when 'vcomplete-mode' is disabled
Date: Tue, 24 May 2022 15:59:11 -0400 (EDT)

branch: elpa/vcomplete
commit 84c888747e99c7ba2097d452318bbfc6ba80bde4
Author: Daniel Semyonov <daniel@dsemy.com>
Commit: Daniel Semyonov <daniel@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)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]