emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 19cc1be 21/45: Use `unwind-protect' for :after-exit


From: Oleh Krehel
Subject: [elpa] master 19cc1be 21/45: Use `unwind-protect' for :after-exit
Date: Thu, 16 Apr 2015 12:45:47 +0000

branch: master
commit 19cc1be6ffbe16a6c6b86ec202ffc83e614e451b
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    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
---
 hydra.el |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/hydra.el b/hydra.el
index bfb003b..3dd7459 100644
--- 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]