[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master f55c1ff 07/27: Add `hydra-is-helpful' custom var
From: |
Oleh Krehel |
Subject: |
[elpa] master f55c1ff 07/27: Add `hydra-is-helpful' custom var |
Date: |
Sat, 24 Jan 2015 20:36:30 +0000 |
branch: master
commit f55c1fff4d64f03a600aea422f81f19432d18bbd
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add `hydra-is-helpful' custom var
* hydra.el (hydra-is-helpful): New custom.
(hydra-create): Display a hint in the echo area when `hydra-is-helpful'
is t.
Re #2.
---
hydra.el | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/hydra.el b/hydra.el
index 9479817..37c2cba 100644
--- a/hydra.el
+++ b/hydra.el
@@ -50,6 +50,16 @@
;;; Code:
(require 'cl-lib)
+(defgroup hydra nil
+ "Make bindings that stick around."
+ :group 'bindings
+ :prefix "hydra-")
+
+(defcustom hydra-is-helpful t
+ "When t, display a hint with possible bindings in the echo area."
+ :type 'boolean
+ :group 'hydra)
+
;;;###autoload
(defmacro hydra-create (body heads &optional method)
"Create a hydra with a BODY prefix and HEADS with METHOD.
@@ -81,7 +91,8 @@ When `(keymapp METHOD)`, it becomes:
`(lambda (key command) (define-key ,method key
command)))
(t
- method))))
+ method)))
+ (hint (concat "hydra: " (mapconcat #'car heads " "))))
`(progn
(,method ,(kbd body) nil)
,@(cl-mapcar
@@ -101,6 +112,8 @@ Call the head: `%S'."
(cdr head))
(interactive)
(call-interactively #',(cdr head))
+ (when hydra-is-helpful
+ (message ,hint))
(set-transient-map ',keymap t)))
heads names)
,@(cl-mapcar
- [elpa] master updated (c7f675e -> 7b78b37), Oleh Krehel, 2015/01/24
- [elpa] master 916a130 05/27: Depend on cl-lib v0.5 for `cl-mapcar', Oleh Krehel, 2015/01/24
- [elpa] master a179f31 04/27: Unbind hydra's body unconditionally to avoid error, Oleh Krehel, 2015/01/24
- [elpa] master abef4bf 02/27: Split away the examples, Oleh Krehel, 2015/01/24
- [elpa] master 2a367fa 03/27: README.md: update doc, Oleh Krehel, 2015/01/24
- [elpa] master f55c1ff 07/27: Add `hydra-is-helpful' custom var,
Oleh Krehel <=
- [elpa] master 9b86656 01/27: Initial import, Oleh Krehel, 2015/01/24
- [elpa] master 6966e14 11/27: Fix the bugged `global-set-key' version, Oleh Krehel, 2015/01/24
- [elpa] master 11323ec 06/27: Allow to use minor-mode-maps and more, Oleh Krehel, 2015/01/24
- [elpa] master dbd77f0 09/27: Don't unbind hydra's body, unless using global-set-key, Oleh Krehel, 2015/01/24
- [elpa] master 998b533 10/27: Make sure `windmove-wrap-around' is nil during tests, Oleh Krehel, 2015/01/24
- [elpa] master 5318fc3 08/27: Update `hydra-create' format, Oleh Krehel, 2015/01/24
- [elpa] master e156bf2 12/27: Require cl at compile time, Oleh Krehel, 2015/01/24
- [elpa] master 69bb4a4 13/27: Fix `kbd' interpretting "<tab>" char-by-char, Oleh Krehel, 2015/01/24
- [elpa] master b982fe5 14/27: Allow to add one head that disables the Hydra, Oleh Krehel, 2015/01/24
- [elpa] master c3ce0a9 15/27: `hydra-create' will also define `hydra-...-body', Oleh Krehel, 2015/01/24