abo-abo / hydra

make Emacs bindings that stick around
1.85k stars 113 forks source link

Binding head does not work even though mentioned in README #377

Open mcp292 opened 4 years ago

mcp292 commented 4 years ago

This binding doesn't work even though there is mention of manually binding:

But then you would have to bind hydra-zoom/text-scale-increase and hydra-zoom/text-scale-decrease yourself.

But binding 'humb-jump-hydra/dumb-jump-go gives an error:

(defhydra dumb-jump-hydra (:color blue)
   "dumb jump"
   ("g" dumb-jump-go "go to declaration")
   ("b" dumb-jump-back "back"))
(global-set-key (kbd "C-M-g") 'dumb-jump-hydra/dumb-jump-go)

Error:

Wrong type argument: commandp, dumb-jump-hydra/dumb-jump-goWrong type argument: commandp, dumb-jump-hydra/dumb-jump-go

My expectation was that this would execute the command and leave the hydra state active.

For reference this achieved what I wanted, but it was hard tracking down documentation for :body-pre:

(defhydra dumb-jump-hydra (:body-pre (dumb-jump-go) :color blue)
   "dumb jump"
   ("g" dumb-jump-go "go to declaration")
   ("b" dumb-jump-back "back"))
(global-set-key (kbd "C-M-g") 'dumb-jump-hydra/body)