Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider replacing which-key #13

Closed
plexus opened this issue Apr 11, 2022 · 4 comments
Closed

Consider replacing which-key #13

plexus opened this issue Apr 11, 2022 · 4 comments

Comments

@plexus
Copy link
Collaborator

plexus commented Apr 11, 2022

I've been looking at a lingering issue in Corkey. When you pop up which-key with a prefix key it generally shows the descriptions provided in the binding/signal files as it should, but for some commands it just shows the function name.

The problem turns out is that which-key can't do minor-mode based replacement, and we have quite a few minor-mode specific bindings.

Going through the which-key sources it struck me that this package is doing a lot of stuff that we don't use/need/want, and the way it goes about its work is needlessly complicated. In Corkey we have all the information we need up-front, so we don't need to deal with replacement data structures. We can just render the normalized signal/binding data directly. Store that in a buffer-local var and be done with it.

which-key is also 2700 lines of code, I think it would be well within the spirit of Corgi to find something smaller that we can more easily adapt to our needs. Or potentially to take inspiration of what's out there and roll our own.

Main candidates I've seen

@plexus
Copy link
Collaborator Author

plexus commented Apr 11, 2022

Scratch Hercules, it actually just uses which-key under the hood :/

@plexus
Copy link
Collaborator Author

plexus commented Apr 19, 2022

transient looks like it's worth a good look as well. At first glance it seems like it's the keybinding system from magit, but split out into its own package, and apparently from Emacs 28 bundled with Emacs (or just elpa?).

Looking at the manual I'm guessing this will not be a small and simple package, but having it built (with fallback to a package for Emacs 27) could be a compelling argument.

I'm still tempted to try to roll something ourself, because I feel like our needs are actually really modest, but maybe I'm underestimating the difficulty of certain aspects. Maybe I need to try to implementing it to start to appreciate what these packages can offer.

@theophilusx
Copy link

I like the idea of developing something specific which works with corkey. Don't know enough about transient to judge how suitable it would be. However, I do believe transient will/is in elpa, which means that it could also be used in Emacs 27 (possibly even Emacs 26).

As you mention, pretty much all the information we need is in the corkey keys file. Having something which uses that information to generate something similar to what which-key does would be great.

Another idea, not deeply considered, might be using hydra? However, that would possibly have a larger impact on corkey and it isn't part of Emacs. Still, might be a source for some ideas.

@plexus
Copy link
Collaborator Author

plexus commented May 5, 2022

Turns out there was a glaringly obvious solution to fixing all of our which-key issues, and reading through more of which-key's source has given me a better appreciation of all the cases it covers, so I no longer see a need to replace it.

corgi-emacs/corkey#3

@plexus plexus closed this as completed May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants