[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mct fb0e7fe 1/4: Simplify mct-edit-completions
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mct fb0e7fe 1/4: Simplify mct-edit-completions |
Date: |
Mon, 29 Nov 2021 02:57:28 -0500 (EST) |
branch: externals/mct
commit fb0e7fe2fd7e1b6bbf048fed79394e6832c82f1f
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Simplify mct-edit-completions
It is necessary to switch to the completions window for the selection to
succeed. Therefore select the completions window right away. Alternatively
use
`switch-to-completions` directly and remove the buffer switching.
---
mct.el | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/mct.el b/mct.el
index 04929c5..9c59ec8 100644
--- a/mct.el
+++ b/mct.el
@@ -800,21 +800,13 @@ determined as follows:
A candidate is recognised for as long as point is not past its
last character."
(interactive nil mct-mode)
- (let* ((window (mct--get-completion-window))
- (buffer (window-buffer window))
- (mini (active-minibuffer-window))
- pos)
- (when (and mini window)
- (with-current-buffer buffer
- (when-let ((old-point (window-old-point window)))
- (if (= old-point (point-min))
- (setq pos (mct--first-completion-point))
- (setq pos old-point))))
- (when pos
- ;; NOTE 2021-10-26: why must we `switch-to-completions' to get a
- ;; valid candidate? Why can't this be part of the above
- ;; `with-current-buffer'?
- (switch-to-completions)
+ (when-let ((window (mct--get-completion-window))
+ (_mini (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)))
(goto-char pos)
(mct-choose-completion-no-exit)))))