[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mct 6db7f29 36/70: Rewrite mct-edit-completion for grea
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mct 6db7f29 36/70: Rewrite mct-edit-completion for greater accuracy |
Date: |
Thu, 11 Nov 2021 03:57:47 -0500 (EST) |
branch: externals/mct
commit 6db7f29f86536b788dffb04b5578ff9176f53887
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Rewrite mct-edit-completion for greater accuracy
---
mct.el | 36 ++++++++++++++++++++++++++----------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git a/mct.el b/mct.el
index 64994bd..0ff6c30 100644
--- a/mct.el
+++ b/mct.el
@@ -664,23 +664,39 @@ Otherwise behave like `mct-choose-completion-exit'."
(let ((inhibit-message t))
(switch-to-completions))))))
+(defun mct--completion-string (point)
+ "Get completion string at POINT."
+ (get-text-property point 'completion--string))
+
(defun mct-edit-completion ()
- "Edit the candidate from the Completions in the minibuffer."
+ "Edit the current completion candidate inside the minibuffer.
+
+The current candidate is the one at point while inside the
+Completions' buffer.
+
+When point is in the minibuffer, the current candidate is
+determined as follows:
+
++ The one at the last known position in the Completions'
+ window (if the window is deleted and produced again, this value
+ is reset).
+
++ The first candidate in the Completions' buffer.
+
+A candidate is recognised for as long as point is not past its
+last character."
(interactive nil mct-mode)
(let (string)
- ;; BUG 2021-07-26: When we use `mct-list-completions-toggle'
- ;; the first line is active even without switching to the
- ;; Completions' buffer, so the user would expect that this command
- ;; would capture the candidate at that point. It does not.
- ;;
- ;; If we focus the Completions' buffer at least once, then
- ;; everything works as expected.
(when (or (and (minibufferp)
(mct--get-completion-window))
(and (derived-mode-p 'completion-list-mode)
(active-minibuffer-window)))
- (with-current-buffer (window-buffer (mct--get-completion-window))
- (setq string (get-text-property (point) 'completion--string)))
+ (let ((window (mct--get-completion-window)))
+ (with-current-buffer (window-buffer window)
+ (when-let ((old-point (window-old-point window)))
+ (if (= old-point (point-min))
+ (setq string (mct--completion-string
(mct--first-completion-point)))
+ (setq string (mct--completion-string old-point))))))
(if string
(progn
(select-window (active-minibuffer-window) nil)
- [elpa] externals/mct 25f876c 34/70: Do not use line-based completion in grid views, (continued)
- [elpa] externals/mct 25f876c 34/70: Do not use line-based completion in grid views, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 8522a67 38/70: Add mct-choose-completion-no-exit command, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 2e8c44a 40/70: Tweak mct-beginning-of-buffer, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 099e204 42/70: Make mct-choose-completion-dwim never exit, ELPA Syncer, 2021/11/11
- [elpa] externals/mct be15b4b 44/70: Re-order mct-completion-list-mode-map, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 640ce43 24/70: Update code sample in mct-display-buffer-action, ELPA Syncer, 2021/11/11
- [elpa] externals/mct d21edfb 26/70: Make mct--fit-completions-window more robust, ELPA Syncer, 2021/11/11
- [elpa] externals/mct dc3c224 32/70: Update Acknowledgements in the manual, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 17abf47 33/70: Make cycling robust for all completions-format, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 613252a 27/70: Use internal function to fit Completions' window, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 6db7f29 36/70: Rewrite mct-edit-completion for greater accuracy,
ELPA Syncer <=
- [elpa] externals/mct b16f582 37/70: Make completion metadata functions work everywhere, ELPA Syncer, 2021/11/11
- [elpa] externals/mct e7f13ee 43/70: Make TAB in the Completions never exit, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 97d7855 45/70: Use correct internals for commit 099e204, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 532656b 54/70: Merge branch 'crm-separator-heuristic' into 'main', ELPA Syncer, 2021/11/11
- [elpa] externals/mct 78f3e77 57/70: Clear trailing space, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 573a324 60/70: Document numeric arg for cyclic commands, ELPA Syncer, 2021/11/11
- [elpa] externals/mct d333057 59/70: Update keys for group navigation, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 981dba1 68/70: Fix typo, ELPA Syncer, 2021/11/11
- [elpa] externals/mct e459304 64/70: Add missing reference to mct-backward-updir, ELPA Syncer, 2021/11/11
- [elpa] externals/mct b5f4222 70/70: Update Acknowledgements in the manual, ELPA Syncer, 2021/11/11