[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mct 8f8a83a 39/70: Make mct-edit-completion behave cons
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mct 8f8a83a 39/70: Make mct-edit-completion behave consistently |
Date: |
Thu, 11 Nov 2021 03:57:47 -0500 (EST) |
branch: externals/mct
commit 8f8a83ac529bba85ff6fb9c2568ec9590278825e
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Make mct-edit-completion behave consistently
---
mct.el | 38 +++++++++++++++++---------------------
1 file changed, 17 insertions(+), 21 deletions(-)
diff --git a/mct.el b/mct.el
index 86f4267..05518fb 100644
--- a/mct.el
+++ b/mct.el
@@ -673,10 +673,6 @@ 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 current completion candidate inside the minibuffer.
@@ -695,23 +691,23 @@ determined as follows:
A candidate is recognised for as long as point is not past its
last character."
(interactive nil mct-mode)
- (let (string)
- (when (or (and (minibufferp)
- (mct--get-completion-window))
- (and (derived-mode-p 'completion-list-mode)
- (active-minibuffer-window)))
- (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)
- (delete-region (minibuffer-prompt-end) (point-max))
- (insert string))
- (user-error "Could not find completion at point")))))
+ (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)
+ (goto-char pos)
+ (mct-choose-completion-no-exit)))))
;;;;; Miscellaneous commands
- [elpa] externals/mct 981dba1 68/70: Fix typo, (continued)
- [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
- [elpa] externals/mct 57cd47d 69/70: Expand mct-live-update; update documentation, ELPA Syncer, 2021/11/11
- [elpa] externals/mct ea0847d 50/70: Update "Alternatives" section; add Elmo, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 5972191 51/70: Update docs on Alternatives; improve vertico part, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 01edefb 14/70: Use memq instead of member where applicable, ELPA Syncer, 2021/11/11
- [elpa] externals/mct c096fab 48/70: Mention completion-cycle-threshold in the manual, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 6eefd80 49/70: Expand the "extensions" section in the manual, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 20aa296 52/70: Heuristic attempt to handle different CRM separator, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 8f8a83a 39/70: Make mct-edit-completion behave consistently,
ELPA Syncer <=
- [elpa] externals/mct 9586c51 41/70: Refine mct-choose-completion{, -no}-exit, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 4d61a41 46/70: Minor tweaks to code sample in the manual, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 2dd1308 53/70: Add functions to jump through completion groups in completions, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 47b26e4 61/70: Document group motions and backward-dir motion, ELPA Syncer, 2021/11/11
- [elpa] externals/mct f1ddc1e 65/70: Add reference to Icomplete and Fido-mode, ELPA Syncer, 2021/11/11
- [elpa] externals/mct e25fdd5 55/70: Merge branch 'completion-group-navigation' into 'main', ELPA Syncer, 2021/11/11
- [elpa] externals/mct 0e2d0ae 62/70: Remove note about crm-separator (see 20aa296), ELPA Syncer, 2021/11/11
- [elpa] externals/mct 2352f14 63/70: Rectify paths to git repo, ELPA Syncer, 2021/11/11
- [elpa] externals/mct cf439ea 35/70: Clarify mct-choose-completion-number doc string, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 9813d90 47/70: Update manual about "selecting candidates", ELPA Syncer, 2021/11/11