[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mct 53dc6be137 20/64: Write routines for next/prev/dire
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mct 53dc6be137 20/64: Write routines for next/prev/directional motions |
Date: |
Thu, 30 Dec 2021 23:57:53 -0500 (EST) |
branch: externals/mct
commit 53dc6be137b676535f3741cea339d4cefb839320
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Write routines for next/prev/directional motions
---
mct.el | 99 +++++++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 55 insertions(+), 44 deletions(-)
diff --git a/mct.el b/mct.el
index 0870e6571d..e8a2f89059 100644
--- a/mct.el
+++ b/mct.el
@@ -592,35 +592,40 @@ ARG is a numeric argument for `next-completion', as
described in
((mct--active-p)
(mct-focus-minibuffer))))
+(defun mct--next-completion (arg)
+ "Routine to move to the next ARGth completion candidate."
+ (if (not (mct--one-column-p))
+ ;; Retaining the column number ensures that things work
+ ;; intuitively in a grid view.
+ (let ((col (current-column)))
+ ;; The `when' is meant to skip past lines that do not
+ ;; contain completion candidates, such as those with
+ ;; `completions-group-format'.
+ (when (mct--completions-no-completion-line-p (or arg 1))
+ (if arg
+ (setq arg 2)
+ (setq arg (1+ arg))))
+ (vertical-motion (or arg 1))
+ (unless (eq col (save-excursion (goto-char (point-at-bol))
(current-column)))
+ (line-move-to-column col))
+ (when (or (> (current-column) col)
+ (not (mct--completions-completion-p)))
+ (next-completion -1)))
+ (next-completion (or arg 1))))
+
(defun mct-next-completion-or-mini (&optional arg)
"Move to the next completion or switch to the minibuffer.
This performs a regular motion for optional ARG lines, but when
point can no longer move in that direction it switches to the
minibuffer."
(interactive "p" mct-mode)
- (cond
- ((mct--bottom-of-completions-p (or arg 1))
- (mct-focus-minibuffer))
- (t
- (if (not (mct--one-column-p))
- ;; Retaining the column number ensures that things work
- ;; intuitively in a grid view.
- (let ((col (current-column)))
- ;; The `when' is meant to skip past lines that do not
- ;; contain completion candidates, such as those with
- ;; `completions-group-format'.
- (when (mct--completions-no-completion-line-p (or arg 1))
- (if arg
- (setq arg 2)
- (setq arg (1+ arg))))
- (vertical-motion (or arg 1))
- (unless (eq col (save-excursion (goto-char (point-at-bol))
(current-column)))
- (line-move-to-column col))
- (when (or (> (current-column) col)
- (not (mct--completions-completion-p)))
- (next-completion -1)))
- (next-completion (or arg 1))))
- (setq this-command 'next-line)))
+ (let ((count (or arg 1)))
+ (cond
+ ((mct--bottom-of-completions-p count)
+ (mct-focus-minibuffer))
+ (t
+ (mct--next-completion count))
+ (setq this-command 'next-line))))
(defun mct--top-of-completions-p (arg)
"Test if point is at the notional top of the Completions.
@@ -630,33 +635,39 @@ ARG is a numeric argument for `previous-completion', as
described in
(mct--completions-line-boundary (mct--first-completion-point))
(= (save-excursion (previous-completion arg) (point)) (point-min))))
+(defun mct--previous-completion (arg)
+ "Routine to move to the previous ARGth completion candidate."
+ (if (not (mct--one-column-p))
+ ;; Retaining the column number ensures that things work
+ ;; intuitively in a grid view.
+ (let ((col (current-column)))
+ ;; The `when' is meant to skip past lines that do not
+ ;; contain completion candidates, such as those with
+ ;; `completions-group-format'.
+ (when (mct--completions-no-completion-line-p (or (- arg) -1))
+ (if arg
+ (setq arg 2)
+ (setq arg (1+ arg))))
+ (vertical-motion (or (- arg) -1))
+ (unless (eq col (save-excursion (goto-char (point-at-bol))
(current-column)))
+ (line-move-to-column col))
+ (when (or (> (current-column) col)
+ (not (mct--completions-completion-p)))
+ (next-completion -1)))
+ (previous-completion (if (natnump arg) arg 1))))
+
(defun mct-previous-completion-or-mini (&optional arg)
"Move to the next completion or switch to the minibuffer.
This performs a regular motion for optional ARG lines, but when
point can no longer move in that direction it switches to the
minibuffer."
(interactive "p" mct-mode)
- (cond
- ((mct--top-of-completions-p (if (natnump arg) arg 1))
- (mct-focus-minibuffer))
- ((if (not (mct--one-column-p))
- ;; Retaining the column number ensures that things work
- ;; intuitively in a grid view.
- (let ((col (current-column)))
- ;; The `when' is meant to skip past lines that do not
- ;; contain completion candidates, such as those with
- ;; `completions-group-format'.
- (when (mct--completions-no-completion-line-p (or (- arg) -1))
- (if arg
- (setq arg 2)
- (setq arg (1+ arg))))
- (vertical-motion (or (- arg) -1))
- (unless (eq col (save-excursion (goto-char (point-at-bol))
(current-column)))
- (line-move-to-column col))
- (when (or (> (current-column) col)
- (not (mct--completions-completion-p)))
- (next-completion -1)))
- (previous-completion (if (natnump arg) arg 1))))))
+ (let ((count (if (natnump arg) arg 1)))
+ (cond
+ ((mct--top-of-completions-p count)
+ (mct-focus-minibuffer))
+ (t
+ (mct--previous-completion count)))))
(defun mct-next-completion-group (&optional arg)
"Move to the next completion group.
- [elpa] externals/mct e4b49f40f1 58/64: Add TODO about local mct-region-mode, (continued)
- [elpa] externals/mct e4b49f40f1 58/64: Add TODO about local mct-region-mode, ELPA Syncer, 2021/12/30
- [elpa] externals/mct a6dac17d1c 59/64: Review mct--region-p for buffer-local mode, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 59431a2622 61/64: Provide global variant of mct-region-mode, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 9e81e4425a 64/64: Complete key bindings of next/prev group motions, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 740d9f5d7d 01/64: Do not bind while-no-input-ignore-events, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 0c575c23c4 04/64: Add TODO: mct-region-mode could be buffer local, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 2413746369 11/64: Merge 'main' into experiment-completion-in-region, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 90aa42f432 13/64: Style the completions regardless of mct variant, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 236e03fd5e 08/64: Install advice to silence messages in region, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 8958528d2e 21/64: Merge branch 'main' into experiment-completion-in-region, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 53dc6be137 20/64: Write routines for next/prev/directional motions,
ELPA Syncer <=
- [elpa] externals/mct 639add9b8e 25/64: Merge 'main' into experiment-completion-in-region, ELPA Syncer, 2021/12/30
- [elpa] externals/mct eaf0f98d55 26/64: Merge branch 'main' into experiment-completion-in-region, ELPA Syncer, 2021/12/30
- [elpa] externals/mct d48e6baae5 27/64: Minor correction in outline heading, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 6bbad9f046 31/64: Remove outdated FIXME, ELPA Syncer, 2021/12/30
- [elpa] externals/mct ca958cba65 32/64: Remove comments on quirky behaviour, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 29015a1699 37/64: Fix performance issues by avoiding recursion, ELPA Syncer, 2021/12/30
- [elpa] externals/mct d45cf4ee26 30/64: Handle current buffer of in-region completion, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 95a37bc66d 36/64: Merge 'main' into experiment-completion-in-region, ELPA Syncer, 2021/12/30
- [elpa] externals/mct 523f84e9ee 39/64: Remove note on mct-region-mode---it works (?) now, ELPA Syncer, 2021/12/30
- [elpa] externals/mct bb44658a8b 43/64: Inhibit messages directly in mct--show-completions, ELPA Syncer, 2021/12/30