mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-23 11:47:58 +01:00
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.
This commit is contained in:
parent
1772b98452
commit
3420cd24d1
1 changed files with 15 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue