-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Which key indicator does not update for nested submenus #139
Comments
Oh, no. This sounds like it needs some restructuring. Currently the indicator function gets called once with the original keymap, and then an entire key sequence in read. I'll think about it. Probably proper support for prefix keys is something worth having, but we could also just try avoiding them in the bindings that come with embark and embark-consult (although that sounds tough, it is getting a little crowded). |
You could go back to the transient keymap 😈 |
I was thinking that but not saying it... |
Maybe I will go back to transient maps. Embark used to be pretty buggy when I used transient maps, but I think I figured out how to fix almost all the bugs it used to have. The one thing I don't know how to implement nicely is In the transient map strategy, I don't run the action, the command loop does. I have access to the action right before it runs and, if it does prompt the user, I also have access during the first minibuffer prompt. I could add self-destructing |
Why not use the post-command-hook for this? Is this not possible? Is it not possible to add advices to lambdas? |
The problem with the post-command-hook is that it runs after every command, so it runs a little too soon. Say the action is One thing I could do is check in the post-command-hook if I'm in a minibuffer for the action, and if so, "postpone it until after the minibuffer exits", that is, remove the post-command-hook and schedule the post-command-hook to be re-added in the minibuffer-exit-hook. I don't know if it is possible to add advice to lambdas, but I think it isn't, the argument of
I had forgotten about this option, thanks for reminding me! |
Sounds so scary! |
After a bunch of experiments it seems this is the winning strategy. I'll try to make the change in the next few days. |
My suggestion would be to not use a lambda but generate a temporary symbol and fset it to a lambda. This is probably the more robust strategy. But this whole idea could also turn into a memory leak, if the this-commands are somehow logged (the same issue with lambdas). Maybe define a global variable embark--this-command, set this-command to embark--run-this-command. embark--run-this-command should then contain a check that the embark--this-command variable is non-nil and should properly reset the variable afterwards. |
Maybe instead of a brand new symbol each time, I should base the symbol name on the action that will run. Have all the |
Yes, that would work too. |
I believe this is actually a which-key bug, see justbur/emacs-which-key#284. But I wonder why you set the overriding keymap around |
What is it that seems unnecessary? If I am to use |
Makes sense! |
Any news on this? Reading through radian-software/selectrum#504 (great tips there) I see that you guys are more into the completing-read prompter, but I couldn't quite get the hang of it. Of course this is a personal thing, but I find that which-key helps me learning the key better than the completing-read prompt does (which on the other hand makes it quicker to actually run the command as I don't have to find it. It's a trade-off). @oantolin's suggestion of sticking with Emacs default I recently switched ivy/counsel for selectrum/consult/maginalia/embark and absolutely love it. Embark have even replaced the hydras I used to have, for a more tight Emacs setup. |
This issue is fixed by #287. The wiki/README still needs an update. Closing. |
I never liked the which-key indicator before, but it seems kind of cool now. I think it's because I know what it took to get here. 😆 |
Oh no, your Emacs will be full-featured soon with which-key. Don't abandon the minimal indicator! |
Doesn't quite work for me, nothing happens when i press But I'm totally digging the vindicator, so I'm going with that for the time being. |
lexical scoping? |
Possibly? I've just copied the code from the wiki to use-packages |
@oantolin No, I didn't, thanks for asking. I kinda fear how many fixes I'll have to apply to my But maybe I'll just stick with the verbose indicator, it's quite excellent. |
I'm glad the verbose indicator is working out for you. However, if you decide you do want to use the which-key indicator, you don't need to enable lexical-binding for your init.el, you can put the which-key in it's own file with lexical binding and then just load it from your init.el! |
I observed this when looking at the consult submenu, see #122 (comment).
The text was updated successfully, but these errors were encountered: