branch: master
commit 301b500ecb350f5519cb7dc38df0c86741efddf4
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
Don't undefine BODY's global binding when it's a prefix
* hydra.el (hydra-create): Update.
Before, this would result in a disaster - all bindings of "C-x" would be
cleared:
(hydra-create "C-x" hydra-example-move-window-splitter)
Now this should be OK. Fixes #4.
---
hydra.el | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/hydra.el b/hydra.el
index 7959466..39ff68b 100644
--- a/hydra.el
+++ b/hydra.el
@@ -117,7 +117,8 @@ When `(keymapp METHOD)`, it becomes:
heads ",\n"))))
`(progn
(when (eq ',method 'global-set-key)
- (global-set-key ,(kbd body) nil))
+ (unless (keymapp (global-key-binding ,(kbd body)))
+ (global-set-key ,(kbd body) nil)))
,@(cl-mapcar
(lambda (head name)
`(defun ,name ()