[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mct 35384917af 01/23: Add prototype for continuous inpu
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mct 35384917af 01/23: Add prototype for continuous input |
Date: |
Fri, 25 Feb 2022 07:57:37 -0500 (EST) |
branch: externals/mct
commit 35384917afe410d9ce1f6a4955957c598ed677a9
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add prototype for continuous input
Based on the idea that is discussed in issue 25:
<https://gitlab.com/protesilaos/mct/-/issues/25>.
THIS IS HIGHLY EXPERIMENTAL.
---
mct.el | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/mct.el b/mct.el
index ef044cbf0a..cec592cc22 100644
--- a/mct.el
+++ b/mct.el
@@ -258,6 +258,20 @@ affairs."
:type 'boolean
:group 'mct)
+;; NOTE 2022-02-22: This is highly experimental!
+(defcustom mct-continuous-self-insert nil
+ "Redirect self-insertions from the Completions to the minibuffer.
+When this variable is set to non-nil value, MCT will intercept
+any call to `self-insert-command' or single character key and
+send it to the minibuffer.
+
+This practically means that while typing in the Completions, the
+input is used to narrow the list of candidates (whereas the
+default is to let the Completions use their own keys and not try
+to send the input to the minibuffer)."
+ :type 'boolean
+ :group 'mct)
+
;;;; Completion metadata
(defun mct--this-command ()
@@ -301,6 +315,22 @@ affairs."
;;;; Basics of intersection between minibuffer and Completions' buffer
+;; FIXME 2022-02-22: Silence message when key binding is undefined.
+(defun mct--redirect-self-insert (&rest _args)
+ "Redirect to the minibuffer per `mct-continuous-self-insert'."
+ (when-let* ((mct-continuous-self-insert)
+ (keys (this-single-command-keys))
+ (char (aref keys 0))
+ (mini (active-minibuffer-window)))
+ (when (and (char-or-string-p char)
+ (not (event-modifiers char)))
+ (select-window mini)
+ (insert char))))
+
+(defun mct--setup-redirect-self-insert ()
+ "Set up `mct-continuous-self-insert'."
+ (add-hook 'pre-command-hook #'mct--redirect-self-insert nil t))
+
(define-obsolete-variable-alias
'mct-hl-line 'mct-highlight-candidate "0.3.0")
@@ -1170,6 +1200,7 @@ region.")
(mct--setup-appearance)
(mct--setup-completion-list-keymap)
(mct--setup-highlighting)
+ (mct--setup-redirect-self-insert)
(mct--setup-line-numbers)
(cursor-sensor-mode)))
- [elpa] externals/mct 2028e464b6 07/23: Reword mct-tcm Commentary, (continued)
- [elpa] externals/mct 2028e464b6 07/23: Reword mct-tcm Commentary, ELPA Syncer, 2022/02/25
- [elpa] externals/mct 4e425dfaef 15/23: Avoid mct-tcm interaction with completion-at-point, ELPA Syncer, 2022/02/25
- [elpa] externals/mct d55400b6b1 13/23: Improve mct-tcm documentation, ELPA Syncer, 2022/02/25
- [elpa] externals/mct 894a6ccc84 19/23: Require seq library in mct-tcm, ELPA Syncer, 2022/02/25
- [elpa] externals/mct 038ff66a54 06/23: Refine mct-tcm interaction model, ELPA Syncer, 2022/02/25
- [elpa] externals/mct a551ab0fdb 05/23: Require mct library, ELPA Syncer, 2022/02/25
- [elpa] externals/mct 9e11607409 14/23: Minor rewording, ELPA Syncer, 2022/02/25
- [elpa] externals/mct dea21e4701 23/23: Warn about mct extensions directory, ELPA Syncer, 2022/02/25
- [elpa] externals/mct 79416f1ca8 08/23: Fix indentation, ELPA Syncer, 2022/02/25
- [elpa] externals/mct 6b6b9c3a9f 18/23: Require subr-x only at compile time, ELPA Syncer, 2022/02/25
- [elpa] externals/mct 35384917af 01/23: Add prototype for continuous input,
ELPA Syncer <=
- [elpa] externals/mct f9394ede61 10/23: Add FIXME for weird Emacs 27 bug, ELPA Syncer, 2022/02/25
- [elpa] externals/mct 7ebf1826b5 02/23: Put "continuous input" code in its own file, ELPA Syncer, 2022/02/25
- [elpa] externals/mct cf9af9118a 12/23: Remove superfluous 'declare-function', ELPA Syncer, 2022/02/25
- [elpa] externals/mct bd105cc7b4 17/23: Handle C-DEL and M-DEL in mct-tcm, ELPA Syncer, 2022/02/25
- [elpa] externals/mct b37bdeb0bf 21/23: Move mct-tcm.el to "extensions" directory, ELPA Syncer, 2022/02/25
- [elpa] externals/mct 3193a95c30 11/23: Simplify &rest in private function, ELPA Syncer, 2022/02/25
- [elpa] externals/mct 1d254a0bb7 16/23: Handle backspace or DEL in mct-tcm, ELPA Syncer, 2022/02/25
- [elpa] externals/mct 973ab321a8 20/23: Add FIXME for Emacs 27, ELPA Syncer, 2022/02/25
- [elpa] externals/mct 8ee4e6d799 09/23: Set mct-live-completion to non-nil, not visible, ELPA Syncer, 2022/02/25
- [elpa] externals/mct e50b222fdf 22/23: Merge branch 'experiment-continuous-input', ELPA Syncer, 2022/02/25