emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/exwm 3420cd2: Add support for accessing keymaps in char


From: Chris Feng
Subject: [elpa] externals/exwm 3420cd2: Add support for accessing keymaps in char-mode
Date: Sun, 3 Nov 2019 08:08:57 -0500 (EST)

branch: externals/exwm
commit 3420cd24d107bf9a0396089bb00396e6ab35447e
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>

    Add support for accessing keymaps in char-mode
    
    * exwm-input.el (exwm-input-invoke-factory): New macro for generating
    new commands that invoke corresponding prefix keys.
---
 exwm-input.el | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/exwm-input.el b/exwm-input.el
index da242e9..4ba39f7 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -1035,6 +1035,21 @@ where both ORIGINAL-KEY and SIMULATED-KEY are key 
sequences."
       (dolist (key keys)
         (exwm-input--fake-key key)))))
 
+;;;###autoload
+(defmacro exwm-input-invoke-factory (keys)
+  "Make a command that invokes KEYS when called.
+
+One use is to access the keymap bound to KEYS (as prefix keys) in char-mode."
+  (let* ((keys (kbd keys))
+         (description (key-description keys)))
+    `(defun ,(intern (concat "exwm-input--invoke--" description)) ()
+       ,(format "Invoke `%s'." description)
+       (interactive)
+       (mapc (lambda (key)
+               (exwm-input--cache-event key t)
+               (exwm-input--unread-event key))
+             ',(listify-key-sequence keys)))))
+
 (defun exwm-input--on-pre-command ()
   "Run in `pre-command-hook'."
   (unless (memq this-command exwm-input-pre-post-command-blacklist)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]