(or emacs irrelevant)

Binding one function multiple times in Hydra

Here's a recent feature that's now available in hydra:

(defhydra hydra-zoom (global-map "<f2>")
  "zoom"
  ("g" text-scale-increase "in")
  ("l" text-scale-decrease "out")
  ("0" (text-scale-set 0) "reset")
  ("1" (text-scale-set 0) :bind nil)
  ("2" (text-scale-set 0) :bind nil :color blue))

Here, the entry points are <f2> g, <f2> l, and <f2> 0, the others aren't bound in the global map. You can also have the same function in both red and blue versions. Here's how the hint will look like:

hydra-multi

The multiply-defined functions will be neatly grouped together.

If you remember, (text-scale-set 0) uses a sexp syntax for a Hydra head: it will be wrapped in (lambda () (interactive) ...) automatically.