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

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

[nongnu] elpa/vcomplete 5391b6e4e2 07/91: Auto update the completion lis


From: ELPA Syncer
Subject: [nongnu] elpa/vcomplete 5391b6e4e2 07/91: Auto update the completion list when completing in-region
Date: Tue, 24 May 2022 15:59:05 -0400 (EDT)

branch: elpa/vcomplete
commit 5391b6e4e283153633ecf97c351933a550cdb2bf
Author: Daniel Semyonov <cmstr@dsemy.com>
Commit: Daniel Semyonov <cmstr@dsemy.com>

    Auto update the completion list when completing in-region
    
    * vcomplete.el (vcomplete--update-in-minibuffer): Rename from
    'vcomplete--update'.
    (vcomplete--update--in-region): New function which updates the
    completion list (when completing in-region).
    (vcomplete--setup): Setup in-region updating when appropriate.
---
 vcomplete.el | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/vcomplete.el b/vcomplete.el
index 274e6cf50a..da3be65b65 100644
--- a/vcomplete.el
+++ b/vcomplete.el
@@ -174,29 +174,41 @@ With prefix argument N, move N items (negative N means 
move forward)."
     map)
   "Key map for ‘vcomplete-mode’ commands.")
 
-(defun vcomplete--update()
-  "Update the ‘*Completions*’ buffer when completing in the minibuffer."
+;;;; Visual completion mode:
+
+(defun vcomplete--update-in-minibuffer ()
+  "Update the completion list when completing in a minibuffer."
   (while-no-input
     (redisplay)
     (unless (eq this-command 'vcomplete--no-update)
       (minibuffer-completion-help))))
 
+(defun vcomplete--update-in-region ()
+  "Update the completion list when completing in-region."
+  (while-no-input
+    (redisplay)
+    (unless (or (eq this-command 'vcomplete--no-update)
+                (eq this-command 'completion-at-point)
+                (null completion-in-region-mode))
+      (completion-help-at-point))))
+
 (defun vcomplete--setup ()
   "Setup ‘vcomplete-mode’."
   (if (minibufferp)
       (progn
         (when (and vcomplete-auto-update minibuffer-completion-table)
           (add-hook 'post-command-hook
-                    #'vcomplete--update nil t))
+                    #'vcomplete--update-in-minibuffer nil t))
         (use-local-map (make-composed-keymap vcomplete-command-map
                                              (current-local-map))))
     (if completion-in-region-mode
         (when-let ((map (assq #'completion-in-region-mode
                               minor-mode-overriding-map-alist)))
+          (when vcomplete-auto-update
+            (add-hook 'post-command-hook
+                      #'vcomplete--update-in-region))
           (setcdr map vcomplete-command-map))
-      (remove-hook 'post-command-hook #'vcomplete--update t))))
-
-;;;; Visual completion mode:
+      (remove-hook 'post-command-hook #'vcomplete--update-in-region t))))
 
 ;;;###autoload
 (define-minor-mode vcomplete-mode



reply via email to

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