Skip to content

Commit

Permalink
Don't bind `hydra-keyboard-quit' in foreign keymaps
Browse files Browse the repository at this point in the history
* hydra.el (defhydra): Update.

Fixes #78.
  • Loading branch information
abo-abo committed Mar 20, 2015
1 parent 97d6987 commit d44bf58
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions hydra.el
Original file line number Diff line number Diff line change
Expand Up @@ -908,31 +908,32 @@ result of `defhydra'."
(cl-mapcar
(lambda (head)
(let ((name (hydra--head-property head :cmd-name)))
(when (cadr head)
(when (or body-key method)
(let ((bind (hydra--head-property head :bind 'default))
(final-key
(if body-key
(vconcat (kbd body-key) (kbd (car head)))
(kbd (car head)))))
(cond ((null bind) nil)

((eq bind 'default)
(list
(if (hydra--callablep method)
'funcall
'define-key)
method
final-key
(list 'function name)))

((hydra--callablep bind)
`(funcall (function ,bind)
,final-key
(function ,name)))

(t
(error "Invalid :bind property %S" head))))))))
(when (and (cadr head)
(not (eq (cadr head) 'hydra-keyboard-quit))
(or body-key method))
(let ((bind (hydra--head-property head :bind 'default))
(final-key
(if body-key
(vconcat (kbd body-key) (kbd (car head)))
(kbd (car head)))))
(cond ((null bind) nil)

((eq bind 'default)
(list
(if (hydra--callablep method)
'funcall
'define-key)
method
final-key
(list 'function name)))

((hydra--callablep bind)
`(funcall (function ,bind)
,final-key
(function ,name)))

(t
(error "Invalid :bind property %S" head)))))))
heads))
(defun ,(intern (format "%S/hint" name)) ()
,(hydra--message name body docstring heads))
Expand Down

0 comments on commit d44bf58

Please sign in to comment.