[Top][All Lists]

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

[elpa] master c3ce0a9 15/27: `hydra-create' will also define `hydra-...-

From: Oleh Krehel
Subject: [elpa] master c3ce0a9 15/27: `hydra-create' will also define `hydra-...-body'
Date: Sat, 24 Jan 2015 20:36:34 +0000

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

    `hydra-create' will also define `hydra-...-body'
    * hydra.el (hydra-create): Update.
    In order to bind hydras in `lispy', I need a way to split the body from
    the heads. Now, this is possible:
        (hydra-create "C-z"
          '(("l" forward-char)
            ("h" backward-char)
            ("j" next-line)
            ("k" previous-line)
        (lispy-define-key lispy-mode-map "z" 'hydra-C-z-body)
 hydra.el |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/hydra.el b/hydra.el
index f1428ab..7959466 100644
--- a/hydra.el
+++ b/hydra.el
@@ -130,6 +130,12 @@ When `(keymapp METHOD)`, it becomes:
                    (message ,hint))
                  (setq hydra-last (set-transient-map ',keymap t)))))
           heads names)
+       (defun ,(intern (format "hydra-%s-body" body)) ()
+         ,doc
+         (interactive)
+         (when hydra-is-helpful
+           (message ,hint))
+         (setq hydra-last (set-transient-map ',keymap t)))
           (lambda (head name)
             `(,method ,(vconcat (kbd body) (kbd (car head))) #',name))

reply via email to

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