Use `unwind-protect' for :after-exit

* hydra.el (hydra--make-defun): Update.

This change makes "C-g" work for this hydra:

(defhydra hydra-goto-line (global-map "M-g"
                           :pre (linum-mode 1)
                           :after-exit (linum-mode -1)
                           :exit t)
  ("g" goto-line "line")
  ("c" goto-char "char"))

Re #90
master
Oleh Krehel 11 years ago
parent 3d7d8c764f
commit 19cc1be6ff
  1. 7
      hydra.el

@ -579,8 +579,11 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
,@(when body-pre (list body-pre))
,@(if (memq color '(blue teal))
`((hydra-keyboard-quit)
,(when cmd `(call-interactively #',cmd))
,@(when body-after-exit (list body-after-exit)))
,(if body-after-exit
`(unwind-protect
,(when cmd `(call-interactively #',cmd))
,body-after-exit)
(when cmd `(call-interactively #',cmd))))
(delq
nil
`(,(when cmd

Loading…
Cancel
Save