justbur / emacs-which-key

Emacs package that displays available keybindings in popup
GNU General Public License v3.0
1.73k stars 87 forks source link

Add support for Devil #353

Open wesnel opened 1 year ago

wesnel commented 1 year ago

What is Devil?

Devil mode trades your comma key in exchange for a modifier-free editing experience in Emacs.

The above description comes from their README at:

https://github.com/susam/devil

Unfortunately, Devil is not currently supported by which-key. For example, when I type , x, the which-key popup for C-x does not appear. Instead, I merely see the following text in the echo area:

Devil: C-x

With this patch, I have mimicked the existing god-mode logic in which-key to intercept the current Devil prompt and spawn a which-key popup.

This feature was requested by susam/devil#3:

justbur commented 1 year ago

It would be nice to abstract this logic on the which-key side, so that any package can use it and which-key doesn't have to know about these packages

AkibAzmain commented 10 months ago

I just tried the PR, and it LGTM.

AkibAzmain commented 10 months ago

Ok I have found a bug, typing , m m (C-M-) throws an error.

jonasfagundes commented 10 months ago

Hi @wesnel, @AkibAzmain :)

What do we need to merge this?

@AkibAzmain you mentioned that you found an error, what was it?

wesnel commented 10 months ago

hi @AkibAzmain, i believe i have fixed your error.

typing , m m equates to typing C-M-, which resulted in the error:

Error running timer ‘which-key--update’: (error "C- must prefix a single character, not M-")

i have fixed this by first performing a check on the current devil command string with key-valid-p. please let me know if anyone knows of a better way to accomplish this.

i have also rebased to fix conflicts with the master branch.

thanks all!

patrickt commented 7 months ago

Would love to see this merged!

justbur commented 6 months ago

Hi, thanks for the contribution. I'm currently working on getting which-key merged into core emacs. In the process, I am disentangling the third-party support code from which-key in a way that will allow for third-party support without putting custom code in the which-key file.

See what I did recently with god-mode so you can update this PR. It may no longer be necessary at all. To be clear the goal is to allow for third-party support without modifying the which-key code at all. This should be possible now, but if not I can make further changes.