Make embark-prefix-help-command work under which-key#810
Conversation
|
I'm not 100% sure but I think that the mere fact that the commit is coauthored by an LLM means I cannot accept it, since Embark is in GNU ELPA and they won't take any LLM-generated code. This is for copyright reasons: it seems likely that LLM code cannot be copyrighted, but anything in GNU ELPA needs to be copyrightable and have its copyright assigned to the FSF. I believe GNU hasn't made a final decision on this, but in the meantime GNU Emacs specifically is not taking any LLM-generated code contributions. |
Oh, the LLM did not write the code. I had it in my config for over a year, before LLM was mainstream. I just asked the LLM to make a draft PR out of the code. So the LLM did not write any code, it updated the README and copy-pasted my code then added whitespace, comments, and function documentation. |
|
I don't know if that changes the situation, I'll ask around. |
d141613 to
a16c425
Compare
|
Okay, so the advice I received is that since you wrote the code, I can review the pull request in the usual way, but I should probably rewrite the change log entry to be safe. |
|
FWIW I am not fond of adding a which-key integration here. I don't even have it installed in my Emacs. Any reason why this code cannot go as well into the wiki? Embark even offers a better alternative to which-key. |
|
I used to feel the same way, @minad, but which-key comes with Emacs now, so I think which-key integration is reasonable (for people who don't recognize the superiority of embark-prefix-help-command 🤷). If which-key were not included with Emacs I would have immediately said "this should go in the wiki". |
How did you pull that off? 🙂 |
|
I figured instead of PRing the shim into Doom Emacs that 99% of people using Emacs enable |
|
Upon further reflection, it does feel a little odd to add support to switch from which-key to embark-prefix-help-command, which is an alternative to which-key. It feels similar to adding markdown syntax support to org mode or a command to vertico to switch to icomplete, which sound like strange things to do. Maybe it would be better to make an embark-which-key package? You could also add the which-key indicator that's on the embark wiki to that package. |
Maybe as a separate file like |
|
Yes, a separate embark-which-key.el file might make sense. I'll think about it a bit. What I use instead of which-key-show-major-mode is embark-bindings, which by default shows only commands bound in the local map and minor mode maps (i.e., commands from the major mode and enabled minor modes). |
I use a stripped-down Emacs.
Well, I maintain my opinion that not every addition to Emacs is or was reasonable. The amount of old cruft in Emacs is staggering. Given that we have a better alternative here I don't see why one should not promote and recommend that instead. In particular I disagree with the way the addition is made here via globally installed advices. This does not look like a clean addition to me. |
When `embark-prefix-help-command' is used as `prefix-help-command' and the which-key package is active, which-key rebinds the help key to its own paging menu while its popup is showing, which shadows the prefix help. Add `:around' advice on `which-key-C-h-dispatch' that routes the help key to Embark when `prefix-help-command' is set to `embark-prefix-help-command', and otherwise defers to which-key. This also handles which-key being summoned explicitly (e.g. via `which-key-show-top-level' or `which-key-show-keymap') rather than from an incomplete key sequence: in that case there is no active prefix to describe, so the keymap which-key is currently displaying is recorded via `:before' advice on `which-key--show-keymap' and passed to `embark-bindings-in-keymap'.
a16c425 to
cde9d27
Compare
|
Note that there is also https://github.com/oantolin/embark/wiki/Additional-Configuration#use-which-key-like-a-key-menu-prompt. I think all of the which-key related code should go into a separate package, and not only minor integrations like this one. It could be part of this repository as embark-which-key.el, but then, Omar is not using which-key, so it won't go maintained, I guess? |
I can maintain it. I'm really awesome and I'm probably gonna use Emacs for another 60 years. |
That's good. But then the which-key integration should be "complete" and also contain this indicator stuff from the wiki. And it should be a separate file at least, or maybe a separate package. To be honest, I had hoped that we could avoid the which-key discussion for a little longer, given that Embark still supports Emacs 29, so we would have to add a dependency here for which-key or make sure that it also compiles fine without which-key or distribute it as separate package or even put it in a separate repository. |
|
I think I would prefer if you made a separate embark-which-key package, @LemonBreezes, for integration. I just added a which-key-like |
Ok. I have been using this code change for over a year in my config. It makes it so
C-hinwhich-keybrings up the Embark prefix help. Very useful and nice!