abo-abo / hydra

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

Avoid exiting the hydra on hitting a wrong key. #17

Closed vkazanov closed 9 years ago

vkazanov commented 9 years ago

While testing the Hydra I noticed that sometimes I accidentally quit the hydra 'mode' by clicking the wrong button. As much as I know from reading your blog this is a design decision.

For some hydras it's ok, for others - might be a problem. If you have, say, a simple hydra using only two bindings - it might be alright, as you don't move your hands a lot.

If you use hydra to build a special mode of sorts - a better code browsing mode, for example - chances are that you will click a wrong button at some point, killing the hydra.

So, the question is... Do you plan to implement a way to disable all non-hydra keybindings while using the hydra?

abo-abo commented 9 years ago

See if the code on branch amaranth is what you want.

vkazanov commented 9 years ago

Yes, this is exactly what I want.

Do you plan to merge the branch into master? Or..?

abo-abo commented 9 years ago

Yep, I'll merge this soon (today). Just need to test for a while, and add docs.

vkazanov commented 9 years ago

I'll test it as soon as you finish the merge. Thanks!

abo-abo commented 9 years ago

It's merged, have a look.

vkazanov commented 9 years ago

Everything works as intended, great!

One detail: pushing the wrong button calls the :post, :pre hooks. Is it supposed to be like that?

abo-abo commented 9 years ago

Probably not. Are you sure that it's calling :pre though? The :post one I can see, and I'll need quite a bit more code to stop it from doing that. But I don't see it calling :pre.

vkazanov commented 9 years ago

Well... I did not debug it, but it does somehow switch the cursor color in the example both ways, doesn't it? :-)

abo-abo commented 9 years ago

No, it switches to black when I press e.g. C-f. It doesn't switch to amaranth. It's supposed to switch to amaranth for each head except blue.

vkazanov commented 9 years ago

Thanks a lot! Hydra turns out to be a great idea.