From d2b921d067d7c7ea2f087b4d8edfdc37bcdf4af8 Mon Sep 17 00:00:00 2001 From: Oleh Krehel Date: Fri, 28 Feb 2020 19:30:33 +0100 Subject: [PATCH] hydra.el (defhydra): :exit key can now also be a sexp Fixes #361 --- hydra.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hydra.el b/hydra.el index 7287d49..2eb79d3 100644 --- a/hydra.el +++ b/hydra.el @@ -915,9 +915,15 @@ BODY-AFTER-EXIT is added to the end of the wrapper." (require 'hydra) (hydra-default-pre) ,@(when body-pre (list body-pre)) - ,@(if (hydra--head-property head :exit) - body-on-exit-t - body-on-exit-nil)))) + ,@(cond ((eq (hydra--head-property head :exit) t) + body-on-exit-t) + ((eq (hydra--head-property head :exit) nil) + body-on-exit-nil) + (t + `((if ,(hydra--head-property head :exit) + (progn + ,@body-on-exit-t) + ,@body-on-exit-nil))))))) (defvar hydra-props-alist nil)