]> code.delx.au - gnu-emacs-elpa/commitdiff
Use `unwind-protect' for :after-exit
authorOleh Krehel <ohwoeowho@gmail.com>
Sat, 11 Apr 2015 13:27:46 +0000 (15:27 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Sat, 11 Apr 2015 13:27:46 +0000 (15:27 +0200)
* 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

hydra.el

index bfb003b5c2f2b7bd07fe9bf43af51762d006f29d..3dd7459f04f18942cef2231529e52bdc2a03b607 100644 (file)
--- a/hydra.el
+++ b/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