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

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

[elpa] master 7aa8187 13/22: Allow to specify :face for each head


From: Oleh Krehel
Subject: [elpa] master 7aa8187 13/22: Allow to specify :face for each head
Date: Fri, 16 Oct 2015 10:06:58 +0000

branch: master
commit 7aa818795758d09ec0c2dd0fdc37e5e418f03f48
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Allow to specify :face for each head
    
    * hydra.el (hydra-fontify-head-default): Update - :face will override
      any previously calculated face (red/blue/pink...).
    
    Example:
    
    (defface hydra-face-orange
        '((t (:foreground "orange" :bold t)))
      "Orange face. For fun.")
    
    (defhydra hydra-projectile (:color blue
                                :columns 4)
      "Projectile"
      ("a" projectile-ag "ag" :face 'hydra-face-orange)
      ("b" projectile-switch-to-buffer "switch to buffer")
      ("c" projectile-invalidate-cache "cache clear")
      ("d" projectile-find-dir "dir")
      ("s-f" projectile-find-file "file")
      ("ff" projectile-find-file-dwim "file dwim")
      ("fd" projectile-find-file-in-directory "file curr dir")
      ("g" ggtags-update-tags "update gtags")
      ("i" projectile-ibuffer "Ibuffer")
      ("K" projectile-kill-buffers "Kill all buffers")
      ("o" projectile-multi-occur "multi-occur")
      ("p" projectile-switch-project "switch")
      ("r" projectile-recentf "recent file")
      ("x" projectile-remove-known-project "remove known")
      ("X" projectile-cleanup-known-projects "cleanup non-existing")
      ("z" projectile-cache-current-file "cache current")
      ("q" nil "cancel"))
---
 hydra.el |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/hydra.el b/hydra.el
index ef2c5a9..73d6621 100644
--- a/hydra.el
+++ b/hydra.el
@@ -505,13 +505,14 @@ HEAD's binding is returned as a string with a colored 
face."
                     "%%"
                   (car head))
                 'face
-                (cl-case head-color
-                  (blue 'hydra-face-blue)
-                  (red 'hydra-face-red)
-                  (amaranth 'hydra-face-amaranth)
-                  (pink 'hydra-face-pink)
-                  (teal 'hydra-face-teal)
-                  (t (error "Unknown color for %S" head))))))
+                (or (hydra--head-property head :face)
+                    (cl-case head-color
+                      (blue 'hydra-face-blue)
+                      (red 'hydra-face-red)
+                      (amaranth 'hydra-face-amaranth)
+                      (pink 'hydra-face-pink)
+                      (teal 'hydra-face-teal)
+                      (t (error "Unknown color for %S" head)))))))
 
 (defun hydra-fontify-head-greyscale (head _body)
   "Produce a pretty string from HEAD and BODY.



reply via email to

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