]> code.delx.au - gnu-emacs-elpa/commitdiff
Quit Hydra for `handle-switch-frame'
authorOleh Krehel <ohwoeowho@gmail.com>
Thu, 9 Apr 2015 11:07:43 +0000 (13:07 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Sat, 11 Apr 2015 09:07:17 +0000 (11:07 +0200)
* hydra.el (hydra--clearfun): Update.
(hydra-base-map): Update.
(hydra--handle-switch-frame): Remove.

Re #90, #73.

hydra.el

index 1234cac190042c413802922215affb2462253f1d..d302de8701c70fb0e9bb2d3e91dfcafc555c4d0b 100644 (file)
--- a/hydra.el
+++ b/hydra.el
@@ -107,15 +107,17 @@ warn: keep KEYMAP and issue a warning instead of running the command."
 
 (defun hydra--clearfun ()
   "Disable the current Hydra unless `this-command' is a head."
-  (unless (eq this-command
-              (lookup-key hydra-curr-map (this-command-keys-vector)))
-    (unless (cl-case hydra-curr-foreign-keys
-              (warn
-               (setq this-command 'hydra-amaranth-warn))
-              (run
-               t)
-              (t nil))
-      (hydra-disable))))
+  (if (eq this-command 'handle-switch-frame)
+      (hydra-disable)
+    (unless (eq this-command
+                (lookup-key hydra-curr-map (this-command-keys-vector)))
+      (unless (cl-case hydra-curr-foreign-keys
+                (warn
+                 (setq this-command 'hydra-amaranth-warn))
+                (run
+                 t)
+                (t nil))
+        (hydra-disable)))))
 
 (defun hydra-disable ()
   "Disable the current Hydra."
@@ -240,16 +242,9 @@ Vanquishable only through a blue head.")
     (define-key map [kp-8] 'hydra--digit-argument)
     (define-key map [kp-9] 'hydra--digit-argument)
     (define-key map [kp-subtract] 'hydra--negative-argument)
-    (define-key map [switch-frame] 'hydra--handle-switch-frame)
     map)
   "Keymap that all Hydras inherit.  See `universal-argument-map'.")
 
-(defun hydra--handle-switch-frame (evt)
-  "Quit hydra and call old switch-frame event handler for EVT."
-  (interactive "e")
-  (hydra-keyboard-quit)
-  (funcall (lookup-key (current-global-map) [switch-frame]) evt))
-
 (defun hydra--universal-argument (arg)
   "Forward to (`universal-argument' ARG)."
   (interactive "P")