abo-abo / hydra

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

FR: calling hydra bodies with an argument #180

Open Nielius opened 8 years ago

Nielius commented 8 years ago

I think the power and usefulness of hydras would be even greater if we could define hydra bodies in such a way that they can accept arguments. As far as I know, this is not yet possible.

A specific problem that I have in mind and that this would solve, is the following. I would like to pass along a file name to the hydra body. In my case this would be the file name of a pdf that I have opened in some pdf viewer and one of the actions would for example insert the current page of the document (using D-Bus). I guess I could also solve the problem with global variables, but that may not be so elegant and in some other cases I have in mind, it would become quite cumbersome.

abo-abo commented 8 years ago

I see no problem here. Elisp is all about global variables, all the best packages have dozens of them. They add more flexibility and normally don't cause a mess.