make standard hydra macro erase previous keyboard bindings

This commit is contained in:
ndwarshuis 2019-04-21 12:35:30 -04:00
parent aaef6b0c70
commit 3b0860eea6
1 changed files with 8 additions and 4 deletions

View File

@ -3094,12 +3094,16 @@ Everyone forgets keybindings. When typing a key chord, this will display a windo
(mk-head-form (mk-head-form
(lambda (cmd) (lambda (cmd)
(-if-let (head-key (alist-get (car it) head-keys)) (-if-let (head-key (alist-get (car it) head-keys))
;; (progn (print (-insert-at 1 (cdr it) head-key)) (-insert-at 1 (cdr it) head-key)
(-insert-at 1 (cdr it) head-key)
;; )
(error "Invalid head keyword: %s" (car it))))) (error "Invalid head keyword: %s" (car it)))))
(heads (--map (funcall mk-head-form it) cmds))) (heads (--map (funcall mk-head-form it) cmds)))
`(defhydra ,hydra-name ,body ,docstring ,@heads))) `(progn
(defhydra ,hydra-name ,body ,docstring ,@heads)
(--> ',heads
(--map (nth 1 it) it)
(--map (where-is-internal it ,keymap nil t) it)
(--each it
(--each it (define-key ,keymap it nil)))))))
(defmacro nd/hydra-standard-int (keymap &rest cmds) (defmacro nd/hydra-standard-int (keymap &rest cmds)
"Create a standardized interactive REPL hydra keymap. "Create a standardized interactive REPL hydra keymap.