]> code.delx.au - gnu-emacs-elpa/commitdiff
Don't undefine BODY's global binding when it's a prefix
authorOleh Krehel <ohwoeowho@gmail.com>
Wed, 21 Jan 2015 16:11:10 +0000 (17:11 +0100)
committerOleh Krehel <ohwoeowho@gmail.com>
Wed, 21 Jan 2015 16:12:50 +0000 (17:12 +0100)
* 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

index 7959466700f001b454fd7dcf932f628bf3421c18..39ff68bc609da8fb72d691337c1220537f5ac326 100644 (file)
--- 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 ()