[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mct 2dd1308 53/70: Add functions to jump through comple
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mct 2dd1308 53/70: Add functions to jump through completion groups in completions |
Date: |
Thu, 11 Nov 2021 03:57:50 -0500 (EST) |
branch: externals/mct
commit 2dd1308335488993d8d6a42ec9cd043af2f38744
Author: James N. V. Cash <james.nvc@gmail.com>
Commit: James N. V. Cash <james.nvc@gmail.com>
Add functions to jump through completion groups in completions
---
mct.el | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/mct.el b/mct.el
index 2ff86b3..29e4abe 100644
--- a/mct.el
+++ b/mct.el
@@ -574,6 +574,39 @@ minibuffer."
(line-move-to-column col)))
(previous-completion (if (natnump arg) arg 1))))))
+(defun mct-next-completion-group (&optional arg)
+ "Move to the next completion group.
+If ARG is supplied, move that many completion groups at a time."
+ (interactive "p" mct-mode)
+ (dotimes (_ (or arg 1))
+ (when-let (group (save-excursion
+ (text-property-search-forward 'face
+
'completions-group-separator
+ t nil)))
+ (let ((pos (prop-match-end group)))
+ (unless (eq pos (point-max))
+ (goto-char pos)
+ (next-completion 1))))))
+
+(defun mct-previous-completion-group (&optional arg)
+ "Move to the previous completion group.
+If ARG is supplied, move that many completion groups at a time."
+ (interactive "p" mct-mode)
+ (dotimes (_ (or arg 1))
+ ;; skip back, so if we're at the top of a group, we go to the previous
one...
+ (next-line -1)
+ (if-let (group (save-excursion
+ (text-property-search-backward 'face
+
'completions-group-separator
+ t nil)))
+ (let ((pos (prop-match-beginning group)))
+ (unless (eq pos (point-min))
+ (goto-char pos)
+ (next-completion 1)))
+ ;; ...and if there was a match, go back down, so the point doesn't
+ ;; end in the group separator
+ (next-line 1))))
+
;;;;; Candidate selection
(defun mct-choose-completion-exit ()
@@ -817,6 +850,8 @@ To be assigned to `minibuffer-setup-hook'."
(define-key map [remap next-line] #'mct-next-completion-or-mini)
(define-key map (kbd "n") #'mct-next-completion-or-mini)
(define-key map [remap previous-line] #'mct-previous-completion-or-mini)
+ (define-key map (kbd "<left>") #'mct-previous-completion-group)
+ (define-key map (kbd "<right>") #'mct-next-completion-group)
(define-key map (kbd "p") #'mct-previous-completion-or-mini)
(define-key map (kbd "M-e") #'mct-edit-completion)
(define-key map (kbd "<tab>") #'mct-choose-completion-no-exit)
- [elpa] externals/mct 57cd47d 69/70: Expand mct-live-update; update documentation, (continued)
- [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, 2021/11/11
- [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 <=
- [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
- [elpa] externals/mct 1313880 56/70: Placate the compiler for group motions, ELPA Syncer, 2021/11/11
- [elpa] externals/mct c9b4cab 58/70: Add James Cash to list of contributors, ELPA Syncer, 2021/11/11
- [elpa] externals/mct 5bb2231 67/70: Reword statement in the manual, ELPA Syncer, 2021/11/11