[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/mct 8ac051b52d 04/23: Reorganise mct-tcm.el; read shift
From: |
ELPA Syncer |
Subject: |
[elpa] externals/mct 8ac051b52d 04/23: Reorganise mct-tcm.el; read shifted keys |
Date: |
Fri, 25 Feb 2022 07:57:37 -0500 (EST) |
branch: externals/mct
commit 8ac051b52d1d98ec7a3ef31e58a62069abac9040
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Reorganise mct-tcm.el; read shifted keys
For a discussion, see issue 25:
<https://gitlab.com/protesilaos/mct/-/issues/25>.
---
mct-tcm.el | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/mct-tcm.el b/mct-tcm.el
index 5160aac1a4..123427d448 100644
--- a/mct-tcm.el
+++ b/mct-tcm.el
@@ -31,7 +31,20 @@
;;;; General utilities
-;; NOTE 2022-02-22: This is highly experimental!
+;; FIXME 2022-02-22: Silence message when key binding is undefined.
+;;;###autoload
+(define-minor-mode mct-tcm-mode
+ "MCT extension to narrow through the Completions.
+It intercepts any single character input (without modifiers) in
+the Completions' buffer and passes it to the minibuffer as input.
+This practically means that the user can switch to the
+Completions and then type something to bring focus to the
+minibuffer while narrowing to the given input."
+ :global t
+ :group 'mct
+ (if mct-tcm-mode
+ (add-hook 'completion-list-mode-hook
#'mct-tcm--setup-redirect-self-insert)
+ (remove-hook 'completion-list-mode-hook
#'mct-tcm--setup-redirect-self-insert)))
(defun mct-tcm--redirect-self-insert (&rest _args)
"Redirect single character keys as input to the minibuffer."
@@ -40,27 +53,17 @@
(char (aref keys 0))
(mini (active-minibuffer-window)))
(when (and (char-or-string-p char)
- (not (event-modifiers char)))
+ (or (memq 'shift (event-modifiers char))
+ (not (event-modifiers char))))
(select-window mini)
(insert char))))
+(declare-function mct--minibuffer-p "mct")
+
(defun mct-tcm--setup-redirect-self-insert ()
"Set up `mct-tcm--redirect-self-insert'."
(when (mct--minibuffer-p)
(add-hook 'pre-command-hook #'mct-tcm--redirect-self-insert nil t)))
-;; FIXME 2022-02-22: Silence message when key binding is undefined.
-(define-minor-mode mct-tcm-mode
- "MCT extension to narrow through the Completions.
-It intercepts any single character input (without modifiers) in
-the Completions' buffer and passes it to the minibuffer as input.
-This practically means that the user can switch to the
-Completions and then type something to bring focus to the
-minibuffer while narrowing to the given input."
- :global t
- (if mct-tcm-mode
- (add-hook 'completion-list-mode-hook
#'mct-tcm--setup-redirect-self-insert)
- (remove-hook 'completion-list-mode-hook
#'mct-tcm--setup-redirect-self-insert)))
-
-(provide 'mct)
-;;; mct.el ends here
+(provide 'mct-tcm)
+;;; mct-tcm.el ends here
- [elpa] externals/mct updated (3c64d4e17f -> dea21e4701), ELPA Syncer, 2022/02/25
- [elpa] externals/mct 8ac051b52d 04/23: Reorganise mct-tcm.el; read shifted keys,
ELPA Syncer <=
- [elpa] externals/mct b97eb2a2e6 03/23: Update mct-tcm doc strings, ELPA Syncer, 2022/02/25
- [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