abo-abo / hydra

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

Hydra doesn't exit on new server frame #105

Closed jhonnyseven closed 9 years ago

jhonnyseven commented 9 years ago

This is while using emacs in terminal. To reproduce:

Opening B doesn't cause a switch-frame event, so that's why that handler doesn't exit the hydra. There are however at least two hooks that get run when B is opened, server-visit-hook and server-switch-hook.

Adding hydra-disable or hydra-keyboard-quit to server-switch-hook don't exit the hydra in A, but at least you can use B normally.

abo-abo commented 9 years ago

Opening B doesn't cause a switch-frame event

This might be an Emacs bug.

Adding hydra-disable or hydra-keyboard-quit to server-switch-hook don't exit the hydra in A, but at least you can use B normally.

None of the hooks work for me. But C-g does, which is the typical user's reaction when something doesn't work. So we're a little inconvenienced, but it's not a disaster.

I'd rather not mess with the hooks, but if you find one that works, I can add it to hydra-default-pre.

jhonnyseven commented 9 years ago

C-g has the same effect as hydra-disable in server-switch-hook here.

The behaviour is that the hydra hint in A disappears and non-head keys work normally. However hydra-head keys re-enter the hydra.

Is there some way to exit the hydra for good other than using one of the exit heads?

abo-abo commented 9 years ago

C-g has the same effect as hydra-disable in server-switch-hook here.

Not for Emacs 24.5.2. I have a complete exit with C-g, but zero effect for server-switch-hook.

Is there some way to exit the hydra for good other than using one of the exit heads?

C-g should always exit any hydra for good.

jhonnyseven commented 9 years ago

24.4.1 here.

C-g in the hydra's frame exits the hydra. C-g in other frames does what I described above, i.e. hydra comes back when I hit some head-key.

PS. How do I get that pretty C-g markup? Couldn't find it in the help.

abo-abo commented 9 years ago

24.4.1 here.

OK, I see what you mean and I can reproduce it on 24.5.2 as well.

C-g in the hydra's frame exits the hydra. C-g in other frames does what I described above, i.e. hydra comes back when I hit some head-key.

C-g sets overriding-terminal-local-map to nil, which is how you turn off a hydra. But this variable is terminal-local. I didn't even know about this type of var before. If I set it in one terminal, it doesn't change in the other. setq-default doesn't work. So I don't really know what can be done at the moment.

PS. How do I get that pretty C-g markup? Couldn't find it in the help.

Like this:

<kbd>C-g</kbd>
abo-abo commented 9 years ago

Pressing any key in the new terminal should now cancel the hydra permanently.