Hydra 0.12.0 is out22 Mar 2015
With a month's time and almost 50 commits since that last one, a new version of Hydra has emerged. As usual, I'll just re-state the release notes.
- Handling of heads with duplicate
- Don't bind
nilin outside keymaps.
- C-g (
hydra-keyboard-quit) should run
:postis called for
hydra-key-format-specis a new defcustom for the keys format in the docstring. It's
"%s"by default, but you can set it to e.g.
"%-4s"if you like.
- The key regex was extended to include most common key binding characters.
hydra-repeatis a hydra-specific
repeatfunction. It behaves as you would expect
- New body option -
:timeout. Use e.g.
:timeout 2.0to set the timer. After the first head is called, a timer is started to disable the hydra. Each new head call resets this timer, so the hydra won't disappear as long as you keep typing.
- Lines are truncated in
lv-message. This is useful for large docstring not to become misaligned when the window becomes too small.
Allow for a
%s(test) spec in the docstring
The spec that's used for e.g.
%S. So if
(test) returns a string, it will be quoted.
This may not be desired, hence the new feature.
(defhydra hydra-marked-items (dired-mode-map "") " Number of marked items: %(length (dired-get-marked-files)) Directory size: %s(shell-command-to-string \"du -hs\") " ("m" dired-mark "mark"))
The pink/amaranth override is set recursively
This fixes the issue in this hydra:
(defhydra hydra-test (:color amaranth) "foo" ("fo" (message "yay")) ("q" nil))
Before, pressing e.g. fp would not issue a warning, since f started its own keymap. This is now fixed.
An option to specify the hint for all heads in body
When you write a large docstring, you usually pass
nil as the hint for most heads.
Now you can omit it, if you set
:hint nil in body.
(defhydra hydra-org-template (:color blue :hint nil) " _c_enter _q_uote _L_aTeX: _l_atex _e_xample _i_ndex: _a_scii _v_erse _I_NCLUDE: _s_rc ^ ^ _H_TML: _h_tml ^ ^ _A_SCII: " ("s" (hot-expand "<s")) ("e" (hot-expand "<e")) ("q" (hot-expand "<q")) ("v" (hot-expand "<v")) ("c" (hot-expand "<c")) ("l" (hot-expand "<l")) ("h" (hot-expand "<h")) ("a" (hot-expand "<a")) ("L" (hot-expand "<L")) ("i" (hot-expand "<i")) ("I" (hot-expand "<I")) ("H" (hot-expand "<H")) ("A" (hot-expand "<A")) ("<" self-insert-command "ins") ("o" nil "quit"))
Emulate org-mode export dispatch with hydra-ox
You can also look at that code to see how nested hydras work. Several other examples were added to hydra-examples.el.
I hope that you enjoy all the new features/fixes, and thanks to all the people that contributed to them. Happy hacking!