[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mct aa41e90 2/5: Merge branch 'main' into 'main'
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mct aa41e90 2/5: Merge branch 'main' into 'main' |
Date: |
Mon, 15 Nov 2021 01:57:22 -0500 (EST) |
branch: externals/mct
commit aa41e90955bf3e15f1fa92f25fafe7ef618b7d9e
Merge: 3995267 cb9ed2e
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Merge branch 'main' into 'main'
Add command mct-complete-and-exit
See merge request protesilaos/mct!3
---
README.org | 7 +++++++
mct.el | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/README.org b/README.org
index 27df526..d5a176b 100644
--- a/README.org
+++ b/README.org
@@ -302,6 +302,13 @@ There are several ways to select a completion candidate.
last one. In contexts that are not CRM-powered, the =M-RET= has the
same effect as =TAB= (~mct-choose-completion-no-exit~).
+ #+findex: mct-complete-and-exit
+7. When point is at the minibuffer, select the current candidate in
+ the completions buffer with =C-RET= (~mct-complete-and-exit~), which
+ has the same effect as first completing with =TAB= and then
+ immediately exit the minibuffer with the completed candidate as the
+ selected one.
+
** Other commands
:PROPERTIES:
:CUSTOM_ID: h:b46a3366-6a7a-49ed-8caa-693d6ee437e9
diff --git a/mct.el b/mct.el
index c0d72a5..be96a8b 100644
--- a/mct.el
+++ b/mct.el
@@ -799,6 +799,12 @@ last character."
(goto-char pos)
(mct-choose-completion-no-exit)))))
+(defun mct-complete-and-exit ()
+ "Complete current input as with
\\<mct-minibuffer-local-completion-map>\\[mct-edit-completion], and exit the
minibuffer with that candidate."
+ (interactive nil mct-mode)
+ (mct-edit-completion)
+ (minibuffer-complete-and-exit))
+
;;;;; Miscellaneous commands
;; This is needed to circumvent `mct--clean-completions' with regard to
@@ -920,6 +926,7 @@ To be assigned to `minibuffer-setup-hook'."
(define-key map (kbd "<tab>") #'minibuffer-force-complete)
(define-key map [remap goto-line] #'mct-choose-completion-number)
(define-key map (kbd "M-e") #'mct-edit-completion)
+ (define-key map (kbd "<C-return>" #'mct-complete-and-exit))
(define-key map (kbd "C-n") #'mct-switch-to-completions-top)
(define-key map (kbd "<down>") #'mct-switch-to-completions-top)
(define-key map (kbd "C-p") #'mct-switch-to-completions-bottom)