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

Teach where-is about transient suffixes #113

Open
tarsius opened this issue Mar 15, 2021 · 0 comments
Open

Teach where-is about transient suffixes #113

tarsius opened this issue Mar 15, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@tarsius
Copy link
Member

tarsius commented Mar 15, 2021

Currently where-is cannot see inside transients, so it can for example only tell users that b is bound to magit-branch, but not that magit-checkout is on b b.

Critical bits of where-is (i.e. where-is-internal) are implemented in C, so this will require changes to Emacs, but since we plan to add transient to the core anyway, this probably won't be much of a problem. I might need some help though.

I haven't looked at it in to much detail yet (or rather it has been a while, and I didn't take notes), but this is one way I could imagine this to work.

  1. Look for the requested command as usual. If at least one non-menu binding is found, then show all the found bindings as usual and be done with it. (This is mostly for performance, maybe we should skip the early exit and always do the following as well.)

  2. Otherwise compile a list of found transient prefix commands.

  3. For each transient request a keymap with the suffix commands.

    This keymap would not necessarily be identical to the keymap that would be used if the transient actually were invoked and it would be cached. A potential difference is that a transient may feature different suffixes depending on state, e.g., "initiate a rebase" vs. "continue the rebase that is already in progress". I think that is okay. Each transient should be able to control how this tentative keymap is calculated, so this should be done using a generic function. If it really mattered, then a method could refuse to cache.

  4. which-key receives the keymap and handles it like any other sub-keymap.

I believe to remember that where-is already behaves similar to that for menu bindings, calculating them on demand and then caching the result.

@tarsius tarsius added the enhancement New feature or request label Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant