[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master f58d356 17/22: Allow #'command syntax for heads, just to h
From: |
Oleh Krehel |
Subject: |
[elpa] master f58d356 17/22: Allow #'command syntax for heads, just to have it |
Date: |
Fri, 16 Oct 2015 10:06:59 +0000 |
branch: master
commit f58d356724ff2ea890dedb0a660cf1dd1ce3e04d
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Allow #'command syntax for heads, just to have it
* hydra.el (hydra--make-callable):
(hydra--head-name): Allow #'command syntax in the CMD place for each
head.
This isn't the recommended syntax, however you can use it if you prefer.
Fixes #156
---
hydra.el | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/hydra.el b/hydra.el
index a9b4587..c5c3196 100644
--- a/hydra.el
+++ b/hydra.el
@@ -363,11 +363,14 @@ When ARG is non-nil, use that instead."
"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."
- (if (or (symbolp x) (functionp x))
- x
- `(lambda ()
- (interactive)
- ,x)))
+ (cond ((or (symbolp x) (functionp x))
+ x)
+ ((and (consp x) (eq (car x) 'function))
+ (cadr x))
+ (t
+ `(lambda ()
+ (interactive)
+ ,x))))
(defun hydra-plist-get-default (plist prop default)
"Extract a value from a property list.
@@ -716,9 +719,13 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
(defun hydra--head-name (h name)
"Return the symbol for head H of hydra with NAME."
(let ((str (format "%S/%s" name
- (if (symbolp (cadr h))
- (cadr h)
- (concat "lambda-" (car h))))))
+ (cond ((symbolp (cadr h))
+ (cadr h))
+ ((and (consp (cadr h))
+ (eq (cl-caadr h) 'function))
+ (cadr (cadr h)))
+ (t
+ (concat "lambda-" (car h)))))))
(when (and (hydra--head-property h :exit)
(not (memq (cadr h) '(body nil))))
(setq str (concat str "-and-exit")))
- [elpa] master 1a13273 06/22: Allow to pause arbitrary hydras to the stack, (continued)
- [elpa] master 1a13273 06/22: Allow to pause arbitrary hydras to the stack, Oleh Krehel, 2015/10/16
- [elpa] master adc2997 08/22: Allow for "_[_" and "_]_" in docs, Oleh Krehel, 2015/10/16
- [elpa] master 1acd5f6 05/22: hydra.el (hydra-face-blue): Customize for dark themes, Oleh Krehel, 2015/10/16
- [elpa] master c8b4749 09/22: Allow binding heads to "%", Oleh Krehel, 2015/10/16
- [elpa] master 7aa8187 13/22: Allow to specify :face for each head, Oleh Krehel, 2015/10/16
- [elpa] master df7b079 10/22: hydra.el (hydra-head-format): Customize the key formatting, Oleh Krehel, 2015/10/16
- [elpa] master 900ca34 04/22: Allow access to the current hydra body, Oleh Krehel, 2015/10/16
- [elpa] master 1e9276a 12/22: Remove trailing whitespace from :columns docstring, Oleh Krehel, 2015/10/16
- [elpa] master 852ae26 14/22: Use quote instead of function to prevent compiler warnings, Oleh Krehel, 2015/10/16
- [elpa] master ea36afc 19/22: Allow "_", "!", and "&" as keys in docstrings, Oleh Krehel, 2015/10/16
- [elpa] master f58d356 17/22: Allow #'command syntax for heads, just to have it,
Oleh Krehel <=
- [elpa] master 27b7f40 15/22: Make find-function work with defhydra, Oleh Krehel, 2015/10/16
- [elpa] master 3fb3168 18/22: hydra.el (hydra--format): Allow "@" key in the docs, Oleh Krehel, 2015/10/16
- [elpa] master 336602f 11/22: Add :columns option for hydra body, Oleh Krehel, 2015/10/16
- [elpa] master 4bf7f1c 21/22: Bump version, Oleh Krehel, 2015/10/16
- [elpa] master c5327e1 16/22: Declare dired-mark to silence byte-compiler, Oleh Krehel, 2015/10/16
- [elpa] master 39eed63 20/22: hydra.el (hydra-disable): Deactivate key-chord advice more, Oleh Krehel, 2015/10/16
- [elpa] master bfeccce 22/22: Merge commit '4bf7f1c9e46fb819c673e55d8a1891774e139f98' from hydra, Oleh Krehel, 2015/10/16