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

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

[elpa] master 8bca51b 04/72: Warn about explict red heads on amaranth bo


From: Oleh Krehel
Subject: [elpa] master 8bca51b 04/72: Warn about explict red heads on amaranth body
Date: Fri, 06 Mar 2015 13:04:00 +0000

branch: master
commit 8bca51bfa18c931a433eb2de42d1a275384a8ae1
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Warn about explict red heads on amaranth body
    
    * hydra.el (defhydra): With amaranth body, all heads that aren't blue
    become amaranth. Specifying red explicitly does nothing. Add a check and
    warn when this happens.
    
    re #29
---
 hydra.el |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/hydra.el b/hydra.el
index f57c9d3..fd24d0c 100644
--- a/hydra.el
+++ b/hydra.el
@@ -180,7 +180,7 @@ It's possible to set this to nil.")
 (defun hydra--make-callable (x)
   "Generate a callable symbol from X.
 If X is a function symbol or a lambda, return it.  Otherwise, it
-should be a single statement. Wrap it in an interactive lambda."
+should be a single statement.  Wrap it in an interactive lambda."
   (if (or (symbolp x) (functionp x))
       x
     `(lambda ()
@@ -419,14 +419,19 @@ except a blue head can stop the Hydra state.
       (if (cl-some `(lambda (h)
                       (eq (hydra--color h ',body-color) 'blue))
                    heads)
-          (define-key keymap [t]
-            `(lambda ()
-               (interactive)
-               (message "An amaranth Hydra can only exit through a blue head")
-               (hydra-set-transient-map hydra-curr-map t)
-               (when hydra-is-helpful
-                 (sit-for 0.8)
-                 (message ,hint))))
+          (progn
+            (when (cl-some `(lambda (h)
+                              (eq (hydra--color h ',body-color) 'red))
+                           heads)
+              (warn "Amaranth body color: upgrading all red heads to 
amaranth"))
+            (define-key keymap [t]
+              `(lambda ()
+                 (interactive)
+                 (message "An amaranth Hydra can only exit through a blue 
head")
+                 (hydra-set-transient-map hydra-curr-map t)
+                 (when hydra-is-helpful
+                   (sit-for 0.8)
+                   (message ,hint)))))
         (error "An amaranth Hydra must have at least one blue head in order to 
exit"))
       (when hydra-keyboard-quit
         (define-key keymap hydra-keyboard-quit



reply via email to

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