Pause or resume the current Hydra07 Jul 2015
Today I'd like to highlight a generic command recently added to
hydra. It's kind of cute, and
maybe something that you didn't even know you wanted. Basically, the
hydra-pause-resume command allows to pause and resume the current
hydra with one key. And it works for all hydras at once, without any
extra configuration. All you have to do is to bind it globally to
whatever you like, for example:
(global-set-key (kbd "C-M-k") 'hydra-pause-resume)
What it does:
- If a hydra is active, deactivate and push it on the stack.
- If no hydra is active, pop one from the stack and call it.
- If the stack is empty, call the last hydra.
Personally, I haven't found too much use from the stack - resuming the last one is enough for me. But the stack comes at no extra cost, and might be useful to someone.
If, for example, you have 2 hydras on the stack, how to resume the older one?
The way stacks work, you simply have to go through all elements one by one. So that's:
- C-M-k to resume the newer one.
- Quit the current one with the appropriate shortcut, only not with C-M-k, since that would just put it back on the stack.
- C-M-k to resume the only one remaining on the stack - the older one.