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

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

[nongnu] elpa/vcomplete 4019e76a3d 78/91: New internal function for gett


From: ELPA Syncer
Subject: [nongnu] elpa/vcomplete 4019e76a3d 78/91: New internal function for getting the '*Completions*' window
Date: Tue, 24 May 2022 15:59:11 -0400 (EDT)

branch: elpa/vcomplete
commit 4019e76a3db21d748be42e7046244ed4c7edf8c5
Author: Daniel Semyonov <daniel@dsemy.com>
Commit: Daniel Semyonov <daniel@dsemy.com>

    New internal function for getting the '*Completions*' window
    
    * vcomplete.el (vcomplete--get-completions-window): New function.
    (vcomplete-with-completions-buffer):
    (vcomplete--disable-completion-in-region): Use the new function.
---
 vcomplete.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/vcomplete.el b/vcomplete.el
index e459c77a44..112bb4c99b 100644
--- a/vcomplete.el
+++ b/vcomplete.el
@@ -128,14 +128,18 @@ Otherwise, operate according to `completion-auto-help'."
 
 ;;;; Completion commands:
 
+(defun vcomplete--get-completions-window ()
+  "Return the window associated with the `*Completions*' buffer).
+This function only searches the frames specified in `vcomplete-search-range'."
+  (get-buffer-window "*Completions*" vcomplete-search-range))
+
 (defmacro vcomplete-with-completions-buffer (&rest body)
   "Evaluate BODY with the `*Completions*' buffer temporarily current.
 While evaluating BODY, BUFFER and WINDOW are locally bound to the
 `*Completions*' buffer and window respectively."
   (declare (debug (&rest form)))
   `(when-let ((buffer (get-buffer "*Completions*"))
-              (window (get-buffer-window
-                       buffer vcomplete-search-range)))
+              (window (vcomplete--get-completions-window)))
      (save-current-buffer
        (set-buffer buffer)
        (unless (derived-mode-p 'completion-list-mode)
@@ -238,7 +242,7 @@ With prefix argument N, move N items (negative N means move 
forward)."
 ;; immediately disabled through `vcomplete--update-in-region'.
 (defun vcomplete--disable-completion-in-region ()
   "Stop completion in region when there is no visible `*Completions*' buffer."
-  (unless (get-buffer-window "*Completions*" vcomplete-search-range)
+  (unless (vcomplete--get-completions-window)
     (completion-in-region-mode -1)))
 
 (defun vcomplete--setup-completions ()



reply via email to

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