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

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

[elpa] externals/mct 9586c51 41/70: Refine mct-choose-completion{, -no}-


From: ELPA Syncer
Subject: [elpa] externals/mct 9586c51 41/70: Refine mct-choose-completion{, -no}-exit
Date: Thu, 11 Nov 2021 03:57:48 -0500 (EST)

branch: externals/mct
commit 9586c510b699591358aab2ac76dc829f8403c8fc
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Refine mct-choose-completion{,-no}-exit
---
 mct.el | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/mct.el b/mct.el
index 6524e85..5989371 100644
--- a/mct.el
+++ b/mct.el
@@ -579,18 +579,23 @@ minibuffer."
 (defun mct-choose-completion-exit ()
   "Run `choose-completion' in the Completions buffer and exit."
   (interactive nil mct-mode)
-  (when (and (derived-mode-p 'completion-list-mode)
-             (active-minibuffer-window))
-    (choose-completion)
-    (minibuffer-force-complete-and-exit)))
+  (when (active-minibuffer-window)
+    (when-let* ((window (mct--get-completion-window))
+                (buffer (window-buffer)))
+      (with-current-buffer buffer
+        (choose-completion))
+      (minibuffer-force-complete-and-exit))))
 
 (defun mct-choose-completion-no-exit ()
   "Run `choose-completion' in the Completions without exiting."
   (interactive nil mct-mode)
-  (when (and (derived-mode-p 'completion-list-mode)
-             (active-minibuffer-window))
-    (let ((completion-no-auto-exit t))
-      (choose-completion))))
+  (when-let* ((window (mct--get-completion-window))
+              (buffer (window-buffer))
+              (mini (active-minibuffer-window)))
+    (with-current-buffer buffer
+      (let ((completion-no-auto-exit t))
+        (choose-completion)))
+    (select-window mini nil)))
 
 (defvar display-line-numbers-mode)
 



reply via email to

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