branch: externals/mct
commit d21edfb0640f45df184985bac11fbf3428a887db
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Make mct--fit-completions-window more robust
---
 mct.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mct.el b/mct.el
index 2ba0f75..70c86b7 100644
--- a/mct.el
+++ b/mct.el
@@ -256,10 +256,10 @@ Add this to `completion-list-mode-hook'."
 
 (defun mct--fit-completions-window ()
   "Fit Completions' buffer to its window."
-  (setq-local window-resize-pixelwise t)
-  (select-window (mct--get-completion-window))
-  (fit-window-to-buffer (mct--get-completion-window)
-                        (floor (frame-height) 2) 1))
+  (when-let ((window (mct--get-completion-window)))
+    (with-current-buffer (window-buffer window)
+      (setq-local window-resize-pixelwise t))
+    (fit-window-to-buffer window (floor (frame-height) 2) 1)))
 
 (defun mct--input-string ()
   "Return the contents of the minibuffer as a string."

Reply via email to