(or emacs irrelevant)

Display the initial Hydra hint with a delay

More hydra goodness incoming, this time thanks to @joedicastro. Firstly, he contributed this awesome-looking twittering-mode hydra to the wiki:

hydra-twittering.png

And a similarly nice one for helm:

hydra-helm-2.png

You can look up the code for both hydras by following the above two links.

Secondly, he gave me a nice idea in #108:

A nice thing that guide-key has is that you can set an idle time to wait until you press a key to activate any head before show the hydra hints buffer (explained in hydra terms). This is very helpful when you know the key bindings by memory and you do not need to see the hints buffer, but if you forget how to activate any head, you simple press the hydra binding and wait the "idle time" and the hints buffer is shown to help you to choose the right next binding.

So this option is now also possible. Here's an example, using hydra-toggle from hydra-examples.el:

(defhydra hydra-toggle (:color blue
                        :idle 1.0)
  "toggle"
  ("a" abbrev-mode "abbrev")
  ("d" toggle-debug-on-error "debug")
  ("f" auto-fill-mode "fill")
  ("t" toggle-truncate-lines "truncate")
  ("q" nil "cancel"))
(global-set-key (kbd "C-c C-v") 'hydra-toggle/body)

So the single change from the old code is :idle 1.0, which means:

After a call to hydra-toggle/body, instead of displaying the hint as usual, start a timer for 1.0 seconds. Once the timer runs out, display the hint. But if the hydra has exited before that time, cancel the timer.

Typically, I'm not a huge fan of timers, but it's nice to have the option. And indeed, I've been noticing that I could do without a hint for some simple and more often used hydras. But a command can go from often to barely used quickly, and disabling the hint altogether seems too harsh. A timer could be a nice middle ground, especially since I can decide whether to use it or not and the interval for each specific hydra.

Anyway, thanks for the contributions. Enjoy the new feature, and keep those good ideas coming!