branch: externals/mct
commit 50d5a8fec4482a7f063b3ce94da57cc4b3ef139a
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>

    Made mct-edit-completion work regardless of window
    
    The problem with the old design was that if the Completions were
    displayed in (minibuffer-selected-window) then the command would not
    switch to the minibuffer but instead stay in the selected window where
    the Completions once were.
    
    Thakns to Andrew Tropin for the detailed feedback in a mailing list
    thread of the rde project:
    
<https://lists.sr.ht/~abcdw/rde-devel/%3C87sfunipyn.fsf%40trop.in%3E#%[email protected]%3E>.
---
 mct.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/mct.el b/mct.el
index f8231e5b7f..0d83a704c9 100644
--- a/mct.el
+++ b/mct.el
@@ -805,14 +805,16 @@ determined as follows:
 
 A candidate is recognised for as long as point is not past its
 last character."
-  (interactive nil mct-mode)
+  (interactive nil mct-minibuffer-mode)
   (when-let ((window (mct--get-completion-window))
              ((active-minibuffer-window)))
-    (with-selected-window window
-      (when-let* ((old-point (window-old-point window))
-                  (pos (if (= old-point (point-min))
-                           (mct--first-completion-point)
-                         old-point)))
+    (with-current-buffer (window-buffer window)
+      (let* ((old-point (save-excursion
+                          (select-window window)
+                          (window-old-point)))
+             (pos (if (= old-point (point-min))
+                      (mct--first-completion-point)
+                    old-point)))
         (goto-char pos)
         (mct-choose-completion-no-exit)))))
 

Reply via email to