]> code.delx.au - gnu-emacs-elpa/commitdiff
hydra.el (hydra-disable): Deactivate key-chord advice more
authorOleh Krehel <ohwoeowho@gmail.com>
Tue, 1 Sep 2015 09:26:21 +0000 (11:26 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Tue, 1 Sep 2015 09:26:21 +0000 (11:26 +0200)
* hydra.el (hydra-disable): Deactivate key-chord advice even if
  `overriding-terminal-local-map' is nil. This situation can happen with
  `multiple-cursors', since it calls `hydra-disable' multiple times, and
  `hydra-default-pre' is called multiple times as well.

Fixes #163

hydra.el

index 3d42c38555b432040bca90ee8f31ba5b0e09a5c1..a7c36bb5777ed59e3ff7915d4fe3ce1dccafcad4 100644 (file)
--- a/hydra.el
+++ b/hydra.el
@@ -141,16 +141,16 @@ warn: keep KEYMAP and issue a warning instead of running the command."
   "Disable the current Hydra."
   (setq hydra-deactivate nil)
   (remove-hook 'pre-command-hook 'hydra--clearfun)
+  (if (fboundp 'remove-function)
+      (remove-function input-method-function #'hydra--imf)
+    (when hydra--input-method-function
+      (setq input-method-function hydra--input-method-function)
+      (setq hydra--input-method-function nil)))
   (dolist (frame (frame-list))
     (with-selected-frame frame
       (when overriding-terminal-local-map
         (internal-pop-keymap hydra-curr-map 'overriding-terminal-local-map)
         (unless hydra--ignore
-          (if (fboundp 'remove-function)
-              (remove-function input-method-function #'hydra--imf)
-            (when hydra--input-method-function
-              (setq input-method-function hydra--input-method-function)
-              (setq hydra--input-method-function nil)))
           (when hydra-curr-on-exit
             (let ((on-exit hydra-curr-on-exit))
               (setq hydra-curr-on-exit nil)