Skip to content

Commit 7222773

Browse files
committed
hydra.el (hydra-disable): adapt to Emacs 24.4.1
The old thing should work for Emacs 25, and some versions older than 24.4.1. Fixes #14.
1 parent 222ba95 commit 7222773

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

hydra.el

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,22 @@ It's intended for the echo area, when a Hydra is active."
188188

189189
(defun hydra-disable ()
190190
"Disable the current Hydra."
191-
(if (functionp hydra-last)
192-
(funcall hydra-last)
193-
(while (and (consp (car emulation-mode-map-alists))
194-
(consp (caar emulation-mode-map-alists))
195-
(equal (cl-cdaar emulation-mode-map-alists) ',keymap))
196-
(setq emulation-mode-map-alists
197-
(cdr emulation-mode-map-alists)))))
191+
(cond
192+
;; Emacs 25
193+
((functionp hydra-last)
194+
(funcall hydra-last))
195+
196+
;; Emacs 24.4.1
197+
((boundp 'overriding-terminal-local-map)
198+
(setq overriding-terminal-local-map nil))
199+
200+
;; older
201+
(t
202+
(while (and (consp (car emulation-mode-map-alists))
203+
(consp (caar emulation-mode-map-alists))
204+
(equal (cl-cdaar emulation-mode-map-alists) ',keymap))
205+
(setq emulation-mode-map-alists
206+
(cdr emulation-mode-map-alists))))))
198207

199208
(defun hydra--doc (body-key body-name heads)
200209
"Generate a part of Hydra docstring.

0 commit comments

Comments
 (0)