[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 1660d71 05/17: Allow :pre and :post to be function symbols
From: |
Oleh Krehel |
Subject: |
[elpa] master 1660d71 05/17: Allow :pre and :post to be function symbols |
Date: |
Tue, 10 Feb 2015 07:13:24 +0000 |
branch: master
commit 1660d71516cb80fe1aa654495ab30594463e8a2a
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Allow :pre and :post to be function symbols
* hydra.el (defhydra): :pre and :post are eihter sexps or function
symbols.
Re #16.
Example:
(defun hydra-vi/pre ()
(set-cursor-color "#e52b50"))
(defun hydra-vi/post ()
(set-cursor-color "#ffffff"))
(global-set-key
(kbd "C-z")
(defhydra hydra-vi
(:pre hydra-vi/pre
:post hydra-vi/post
:color amaranth)
"vi"
("l" forward-char)
("h" backward-char)
("j" next-line)
("k" previous-line)
("m" set-mark-command "mark")
("a" move-beginning-of-line "beg")
("e" move-end-of-line "end")
("d" delete-region "del" :color blue)
("y" kill-ring-save "yank" :color blue)
("q" nil "quit")))
---
hydra.el | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/hydra.el b/hydra.el
index 89f21d8..db0a89b 100644
--- a/hydra.el
+++ b/hydra.el
@@ -352,6 +352,10 @@ in turn can be either red or blue."
(when (and (or body-pre body-post)
(version< emacs-version "24.4"))
(error "At least Emacs 24.4 is needed for :pre and :post"))
+ (when (and body-pre (symbolp body-pre))
+ (setq body-pre `(funcall #',body-pre)))
+ (when (and body-post (symbolp body-post))
+ (setq body-post `(funcall #',body-post)))
(when (eq body-color 'amaranth)
(if (cl-some `(lambda (h)
(eq (hydra--color h ',body-color) 'blue))
- [elpa] master updated (61bddf2 -> 11b130e), Oleh Krehel, 2015/02/10
- [elpa] master b65db57 02/17: Update :post for amaranth Hydras, Oleh Krehel, 2015/02/10
- [elpa] master 9991985 01/17: hydra-test.el: update the test to not fail for older Emacs, Oleh Krehel, 2015/02/10
- [elpa] master 1660d71 05/17: Allow :pre and :post to be function symbols,
Oleh Krehel <=
- [elpa] master 7ead8db 06/17: hydra.el (defhydra): Declare indent 2, Oleh Krehel, 2015/02/10
- [elpa] master 1b1d31d 07/17: Support local hydra heads, Oleh Krehel, 2015/02/10
- [elpa] master 9a8e2f1 04/17: hydra.el (hydra-keyboard-quit): New custom var, Oleh Krehel, 2015/02/10
- [elpa] master 9b31ead 08/17: Update semantics for local heads to `:bind nil', Oleh Krehel, 2015/02/10
- [elpa] master 969fa66 10/17: fix typo - single not singe, Oleh Krehel, 2015/02/10
- [elpa] master d41be74 11/17: `hydra/body' will pass the initial `current-prefix-arg' along, Oleh Krehel, 2015/02/10
- [elpa] master ad771a4 03/17: Move defun-creating code into a defun, Oleh Krehel, 2015/02/10
- [elpa] master 763bb2a 13/17: Allow lambda :bind property for body and heads, Oleh Krehel, 2015/02/10
- [elpa] master 0712a43 12/17: README.md: update, Oleh Krehel, 2015/02/10
- [elpa] master d10c26e 14/17: Update comments and mark the old examples obsolete, Oleh Krehel, 2015/02/10