Add key-to-key binding support to map!

Experimental, and will eventually be replaced by general-simulate-key.
This commit is contained in:
Henrik Lissner 2018-09-18 15:07:21 -04:00
parent 80e8ccec1c
commit 895df84f8b

View file

@ -245,6 +245,16 @@ Example
(unless (> (length rest) 0) (unless (> (length rest) 0)
(user-error "map! has no definition for %s key" key)) (user-error "map! has no definition for %s key" key))
(setq def (pop rest)) (setq def (pop rest))
(when (or (vectorp def)
(stringp def))
(setq def
`(lambda () (interactive)
(setq unread-command-events
(nconc (mapcar (lambda (ev) (cons t ev))
(listify-key-sequence
,(cond ((vectorp def) def)
((stringp def) (kbd def)))))
unread-command-events)))))
(when desc (when desc
(push `(doom--keybind-register ,(key-description (eval key)) (push `(doom--keybind-register ,(key-description (eval key))
,desc ',modes) ,desc ',modes)