[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 41f98bd 66/72: Don't wrap `hydra-repeat'
From: |
Oleh Krehel |
Subject: |
[elpa] master 41f98bd 66/72: Don't wrap `hydra-repeat' |
Date: |
Fri, 06 Mar 2015 13:04:24 +0000 |
branch: master
commit 41f98bdfc8a6210e7785f1e87e5425ff46bf1b92
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Don't wrap `hydra-repeat'
* hydra.el (hydra--delete-duplicates): Update.
(hydra--vconcat): Trim trailing spaces.
* hydra-test.el (hydra-red-error): Update test.
(hydra--table): Update test.
---
hydra-test.el | 56 +++++++++++++++++++++++++++++++++++---------------------
hydra.el | 8 ++++++--
2 files changed, 41 insertions(+), 23 deletions(-)
diff --git a/hydra-test.el b/hydra-test.el
index a4a9a00..754984d 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -34,13 +34,15 @@
"error"
("h" first-error "first")
("j" next-error "next")
- ("k" previous-error "prev")))
+ ("k" previous-error "prev")
+ ("SPC" hydra-repeat "rep" :bind nil)))
'(progn
(defun hydra-error/first-error nil "Create a hydra with a \"M-g\" body
and the heads:
\"h\": `first-error',
\"j\": `next-error',
-\"k\": `previous-error'
+\"k\": `previous-error',
+\"SPC\": `hydra-repeat'
The body can be accessed via `hydra-error/body'.
@@ -49,7 +51,8 @@ Call the head: `first-error'."
(hydra-disable)
(catch (quote hydra-disable)
(condition-case err (prog1 t (call-interactively (function
first-error)))
- ((quit error) (message "%S" err)
+ ((quit error)
+ (message "%S" err)
(unless hydra-lv (sit-for 0.8))
nil))
(when hydra-is-helpful (hydra-error/hint))
@@ -57,6 +60,7 @@ Call the head: `first-error'."
(hydra-set-transient-map
(setq hydra-curr-map
(quote (keymap (7 . hydra-keyboard-quit)
+ (32 . hydra-repeat)
(107 . hydra-error/previous-error)
(106 . hydra-error/next-error)
(104 . hydra-error/first-error)
@@ -88,7 +92,8 @@ Call the head: `first-error'."
\"h\": `first-error',
\"j\": `next-error',
-\"k\": `previous-error'
+\"k\": `previous-error',
+\"SPC\": `hydra-repeat'
The body can be accessed via `hydra-error/body'.
@@ -97,7 +102,8 @@ Call the head: `next-error'."
(hydra-disable)
(catch (quote hydra-disable)
(condition-case err (prog1 t (call-interactively (function
next-error)))
- ((quit error) (message "%S" err)
+ ((quit error)
+ (message "%S" err)
(unless hydra-lv (sit-for 0.8))
nil))
(when hydra-is-helpful (hydra-error/hint))
@@ -105,6 +111,7 @@ Call the head: `next-error'."
(hydra-set-transient-map
(setq hydra-curr-map
(quote (keymap (7 . hydra-keyboard-quit)
+ (32 . hydra-repeat)
(107 . hydra-error/previous-error)
(106 . hydra-error/next-error)
(104 . hydra-error/first-error)
@@ -136,7 +143,8 @@ Call the head: `next-error'."
\"h\": `first-error',
\"j\": `next-error',
-\"k\": `previous-error'
+\"k\": `previous-error',
+\"SPC\": `hydra-repeat'
The body can be accessed via `hydra-error/body'.
@@ -145,7 +153,8 @@ Call the head: `previous-error'."
(hydra-disable)
(catch (quote hydra-disable)
(condition-case err (prog1 t (call-interactively (function
previous-error)))
- ((quit error) (message "%S" err)
+ ((quit error)
+ (message "%S" err)
(unless hydra-lv (sit-for 0.8))
nil))
(when hydra-is-helpful (hydra-error/hint))
@@ -153,6 +162,7 @@ Call the head: `previous-error'."
(hydra-set-transient-map
(setq hydra-curr-map
(quote (keymap (7 . hydra-keyboard-quit)
+ (32 . hydra-repeat)
(107 . hydra-error/previous-error)
(106 . hydra-error/next-error)
(104 . hydra-error/first-error)
@@ -184,23 +194,26 @@ Call the head: `previous-error'."
(define-key global-map (kbd "M-g")
nil))
(define-key global-map [134217831 104]
- (function hydra-error/first-error))
+ (function hydra-error/first-error))
(define-key global-map [134217831 106]
- (function hydra-error/next-error))
+ (function hydra-error/next-error))
(define-key global-map [134217831 107]
- (function hydra-error/previous-error))
+ (function hydra-error/previous-error))
(defun hydra-error/hint nil
- (if hydra-lv (lv-message (format #("error: [h]: first, [j]: next, [k]:
prev." 8 9 (face hydra-face-red)
+ (if hydra-lv (lv-message (format #("error: [h]: first, [j]: next, [k]:
prev, [SPC]: rep." 8 9 (face hydra-face-red)
20 21 (face hydra-face-red)
- 31 32 (face hydra-face-red))))
- (message (format #("error: [h]: first, [j]: next, [k]: prev." 8 9
(face hydra-face-red)
+ 31 32 (face hydra-face-red)
+ 42 45 (face hydra-face-red))))
+ (message (format #("error: [h]: first, [j]: next, [k]: prev, [SPC]:
rep." 8 9 (face hydra-face-red)
20 21 (face hydra-face-red)
- 31 32 (face hydra-face-red))))))
+ 31 32 (face hydra-face-red)
+ 42 45 (face hydra-face-red))))))
(defun hydra-error/body nil "Create a hydra with a \"M-g\" body and the
heads:
\"h\": `first-error',
\"j\": `next-error',
-\"k\": `previous-error'
+\"k\": `previous-error',
+\"SPC\": `hydra-repeat'
The body can be accessed via `hydra-error/body'."
(interactive)
@@ -212,6 +225,7 @@ The body can be accessed via `hydra-error/body'."
(setq hydra-curr-map
(quote
(keymap (7 . hydra-keyboard-quit)
+ (32 . hydra-repeat)
(107 . hydra-error/previous-error)
(106 . hydra-error/next-error)
(104 . hydra-error/first-error)
@@ -1067,14 +1081,14 @@ When non-nil, hydra will issue some non essential style
warnings. %`hy
_p_ Captain Jean Luc Picard: % -8`hydra-tng/picard^^ _t_ Deanna Troi:
% -8`hydra-tng/troi^^^^^^
_r_ Commander William Riker: % -8`hydra-tng/riker^^^ _c_ Doctor Beverly
Crusher: % -8`hydra-tng/dr-crusher
_d_ Lieutenant Commander Data: % -8`hydra-tng/data^^^^ _h_ Set phasers to
% -8`hydra-tng/phaser^^^^
-_w_ Worf: % -8`hydra-tng/worf^^^^
-_f_ Geordi La Forge: % -8`hydra-tng/la-forge " 1)))
+_w_ Worf: % -8`hydra-tng/worf^^^^
+_f_ Geordi La Forge: % -8`hydra-tng/la-forge" 1)))
(should (equal (hydra--table hydra-tng/names 4 3)
(substring "
-_p_ Captain Jean Luc Picard: % -8`hydra-tng/picard _f_ Geordi La Forge:
% -8`hydra-tng/la-forge^^
-_r_ Commander William Riker: % -8`hydra-tng/riker^ _t_ Deanna Troi:
% -8`hydra-tng/troi^^^^^^
-_d_ Lieutenant Commander Data: % -8`hydra-tng/data^^ _c_ Doctor Beverly
Crusher: % -8`hydra-tng/dr-crusher
-_w_ Worf: % -8`hydra-tng/worf^^ _h_ Set phasers to
% -8`hydra-tng/phaser^^^^ " 1)))))
+_p_ Captain Jean Luc Picard: % -8`hydra-tng/picard _f_ Geordi La Forge:
% -8`hydra-tng/la-forge^^
+_r_ Commander William Riker: % -8`hydra-tng/riker^ _t_ Deanna Troi:
% -8`hydra-tng/troi^^^^^^
+_d_ Lieutenant Commander Data: % -8`hydra-tng/data^^ _c_ Doctor Beverly
Crusher: % -8`hydra-tng/dr-crusher
+_w_ Worf: % -8`hydra-tng/worf^^ _h_ Set phasers to
% -8`hydra-tng/phaser^^^^" 1)))))
(provide 'hydra-test)
diff --git a/hydra.el b/hydra.el
index 6eb9526..bd05551 100644
--- a/hydra.el
+++ b/hydra.el
@@ -647,7 +647,8 @@ NAME, BODY and HEADS are parameters to `defhydra'."
(defun hydra--delete-duplicates (heads)
"Return HEADS without entries that have the same CMD part.
In duplicate HEADS, :cmd-name is modified to whatever they duplicate."
- (let (res ali entry)
+ (let ((ali '(((hydra-repeat . red) . hydra-repeat)))
+ res entry)
(dolist (h heads)
(if (setq entry (assoc (cons (cadr h)
(hydra--head-color h '(nil nil)))
@@ -702,7 +703,10 @@ NAMES is a list of variables."
JOINER is a function similar to `concat'."
(setq joiner (or joiner #'concat))
(mapconcat
- #'identity
+ (lambda (s)
+ (if (string-match " +$" s)
+ (replace-match "" nil nil s)
+ s))
(apply #'cl-mapcar joiner
(mapcar
(lambda (s) (split-string s "\n"))
- [elpa] master 8e90037 65/72: Add some features for generating tables, (continued)
- [elpa] master 8e90037 65/72: Add some features for generating tables, Oleh Krehel, 2015/03/06
- [elpa] master 3040f45 61/72: hydra.el (hydra--format): Amend key regex, Oleh Krehel, 2015/03/06
- [elpa] master e1e2e3e 69/72: lv.el (lv-window): Bind `golden-ratio-mode' to nil, Oleh Krehel, 2015/03/06
- [elpa] master 8dec3cd 70/72: Allow for a %s(test) spec in docstring, Oleh Krehel, 2015/03/06
- [elpa] master 9fc928b 63/72: hydra.el (hydra--format): Amend key regex, Oleh Krehel, 2015/03/06
- [elpa] master 989ed95 53/72: Rename compat toggle - :nonheads -> :foreign-keys, Oleh Krehel, 2015/03/06
- [elpa] master 9c68e0a 68/72: Add :timeout option to hydra body, Oleh Krehel, 2015/03/06
- [elpa] master e342c33 71/72: hydra-ox.el: Emulate org-mode export dispatch, Oleh Krehel, 2015/03/06
- [elpa] master 6d6bbd4 62/72: hydra.el (hydra-key-format-spec): set default to "%s", Oleh Krehel, 2015/03/06
- [elpa] master 26c3fee 60/72: Remove hydra-exit, Oleh Krehel, 2015/03/06
- [elpa] master 41f98bd 66/72: Don't wrap `hydra-repeat',
Oleh Krehel <=
- [elpa] master 3222b0c 72/72: Merge commit 'e342c330807fdd09adba974611122d1c95bdf07d' from hydra, Oleh Krehel, 2015/03/06