branch: externals/hydra commit 05871dd6c8af7b2268bd1a10eb9f8a3e423209cd Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
hydra.el (defhydra): Document the :column feature Fixes #307 --- README.md | 1 + hydra-examples.el | 7 +++++++ hydra.el | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8bf315bbf4..eb8a9b125c 100644 --- a/README.md +++ b/README.md @@ -427,3 +427,4 @@ Here's a list of body keys that can be overridden in each head: - `:exit` - `:color` - `:bind` +- `:column` diff --git a/hydra-examples.el b/hydra-examples.el index 70f75b0ea4..a02473822a 100644 --- a/hydra-examples.el +++ b/hydra-examples.el @@ -333,6 +333,13 @@ _y_: ?y? year _q_: quit _L__l__c_: log = ?l?" ;; Recommended binding: ;; (define-key org-agenda-mode-map "v" 'hydra-org-agenda-view/body) +;;** Example 13: automatic columns +(defhydra hydra-movement () + ("j" next-line "down" :column "Vertical") + ("k" previous-line "up") + ("l" forward-char "forward" :column "Horizontal") + ("h" backward-char "back")) + ;;* Helpers (require 'windmove) diff --git a/hydra.el b/hydra.el index 6d36473f7d..87e7376301 100644 --- a/hydra.el +++ b/hydra.el @@ -1182,7 +1182,7 @@ nil. If you don't even want the KEY to be printed, set HINT explicitly to nil. The heads inherit their PLIST from BODY-PLIST and are allowed to -override some keys. The keys recognized are :exit and :bind. +override some keys. The keys recognized are :exit, :bind, and :column. :exit can be: - nil (default): this head will continue the Hydra state. @@ -1192,6 +1192,8 @@ override some keys. The keys recognized are :exit and :bind. - nil: this head will not be bound in BODY-MAP. - a lambda taking KEY and CMD used to bind a head. +:column is a string that sets the column for all subsequent heads. + It is possible to omit both BODY-MAP and BODY-KEY if you don't want to bind anything. In that case, typically you will bind the generated NAME/body command. This command is also the return