emacs-helm / helm-descbinds

A helm frontend for describe-bindings.
GNU General Public License v3.0
116 stars 12 forks source link

which-key breakage on spacemacs #32

Closed rocha closed 8 months ago

rocha commented 8 months ago

See https://github.com/syl20bnr/spacemacs/issues/16276

It is possible that commit d1c46d5645 is not correctly re-enabling which-key mode.

thierryvolpiatto commented 8 months ago

Carlos Andrés Rocha @.***> writes:

  1. ( ) text/plain (*) text/html

See syl20bnr/spacemacs#16276

It is possible that commit d1c46d5 is not correctly re-enabling which-key mode.

This commit IS disabling which-key-mode when enabling helm-descbinds-mode and reenabling it when disabling helm-descbinds-mode again.

The reason is that which-key-mode runs a popup defeating helm-descbinds, e.g. When hitting C-x, if you don't quickly hit C-h which-key popup.

So the goal of this commit is to prevent the usage of both packages together, so use one or the other (they do more or less the same, helm-descbinds proposing more actions and the ability to narrow down candidates as always in helm).

This is always the same issue with Spacemacs loading all the packages of the planet at the same time...

NOTE: There is a discussion on Emacs about integrating which-key but without the nasty timer.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.*Message ID: @.***>

-- Thierry

rocha commented 8 months ago

Thanks for the explanation. I opened the issue just to call attention to the problem, but unfourtunately I didn't read the code to figure out what was going on.

As I understand, the intent of spacemacs is to support both packages, since on the "main menu"* (SPC or M-m) the ? key is binded by default to helm-descbinds as "show keybindings".

Shouldn't this be a configuration issue? If an Emacs installation decides to run both packages, shouldn't their configuration should be the one deciding how to make them interact?

thierryvolpiatto commented 8 months ago

Carlos Andrés Rocha @.***> writes:

Thanks for the explanation. I opened the issue just to call attention to the problem, but unfourtunately I didn't read the code to figure out what was going on.

As I understand, the intent of spacemacs is to support both packages, since on the "main menu"* (SPC or M-m) the ? key is binded by default to helm-descbinds as "show keybindings".

Shouldn't this be a configuration issue?

Yes.

If an Emacs installation decides to run both packages, shouldn't their configuration should be the one deciding how to make them interact?

It is what helm-descbinds last commit provides, allow one installing both packages without conflict, see below how to configure.

• using which-key by default

It's easy, to have which-key by default, use:

(which-key-mode 1) and (helm-descbinds-mode -1).

To use helm-descbinds by default, (helm-descbinds-mode 1).

-- Thierry

ezaquarii commented 8 months ago

The mode cannot be enabled, and this is the offending line:

helm-descbinds.el:157:        (advice-add 'which-key-mode :override #'ignore))

It's also visible if (describe-function 'which-key-mode):

This function has :override advice: ‘ignore’.

This is an :override advice, which means that ‘which-key-mode’ isn’t
run at all, and the documentation below may be irrelevant.
davidpiano commented 8 months ago

This is an :override advice, which means that ‘which-key-mode’ isn’t run at all, and the documentation below may be irrelevant.

I think I'm misunderstanding. Does this mean which-key becomes completely inoperable just because helm-descbinds is installed? Or which-key becomes completely inoperable from the first time helm-descbinds is called? Or something else?

dankessler commented 8 months ago

I think I'm misunderstanding. Does this mean which-key becomes completely inoperable just because helm-descbinds is installed? Or which-key becomes completely inoperable from the first time helm-descbinds is called? Or something else?

Good question! Let me try to clarify

That said, it depends on what you mean by "install." If by "install" you mean mean enabling the helm layer in spacemacs, then that will not only install helm-descbinds but also activate its minor mode (by putting helm-descbinds-mode on the helm-mode-hook), which will then disable which-key-mode

dankessler commented 8 months ago

@thierryvolpiatto would you be open to a PR that adds a customization option to the helm-descbinds group for people that want to use which-key-mode and helm-descbinds-mode simultaneously? It could default to "yes, disable which-key-mode upon activation of helm-descbinds-mode" to reflect the current state of behavior.

I totally understand that you find which-key's timer pesky, but I was quite happy using them together wherein if the which-key timer beat me, I just had to hit C-h one more time. Indeed, the documentation for which-key suggests this as the expected usage for people who want to use helm-descbinds along with which-key.

thierryvolpiatto commented 8 months ago

Dan Kessler @.***> writes:

  1. ( ) text/plain (*) text/html

@thierryvolpiatto would you be open to a PR that adds a customization option to the helm-descbinds group for people that want to use which-key-mode and helm-descbinds-mode simultaneously? It could default to "yes, disable which-key-mode upon activation of helm-descbinds-mode" to reflect the current state of behavior.

I am open to any solutions, but I suggest to wait what will come up with the possible integration of which-key in Emacs before doing anything. Possibly they will disable the timer implementation which would be a good thing (Emacs-30 already shows a minibuffer message about C-h after entering a prefix).

I totally understand that you find which-key's timer pesky, but I was quite happy using them together wherein if the which-key timer beat me, I just had to hit C-h one more time. Indeed, the documentation for which-key suggests this as the expected usage for people who want to use helm-descbinds along with which-key.

Thanks, didn't find this in documentation though I still don't understand why 2 packages showing the same thing are needed, but perhaps I missed some which-key features that helm-descbinds doesn't have?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.*Message ID: @.***>

-- Thierry

davidpiano commented 8 months ago

Which-key is (or can be configured to be) hierarchical, showing me (while I'm in the middle of a key sequence) "if I now press B, what category of things will that lead to?" (I mean it is showing the process step by step, sort of a "decision tree", listing each single key that could validly be pressed next, but not showing the sequences they belong to.) Helm-descbinds, as far as I'm aware, always begins by showing the finest level of detail (yes the list is divided into categories, but to see what the next category is, it's necessary to scroll through every detail of this category first).

Which-key also displays (or can be configured to display) in more than one column, showing more possibilities at once.

thierryvolpiatto commented 8 months ago

davidpiano @.***> writes:

  1. ( ) text/plain (*) text/html

Which-key is (or can be configured to be) hierarchical, showing me (while I'm in the middle of a key sequence) "if I now press B, what category of things will that lead to?" (I mean it is showing the process step by step, sort of a "decision tree", listing each single key that could validly be pressed next, but not showing the sequences they belong to.)

Thanks for explanations. AFAIU what you call category is a new prefix, e.g. if you type C-x C-h and then 8 the new prefix is now C-x 8, as helm-descbinds is matching on keys and bindings, it will show all the C-x 8 prefixes as well.

Helm-descbinds, as far as I'm aware, always begins by showing the finest level of detail (yes the list is divided into categories, but to see what the next category is, it's necessary to scroll through every detail of this category first).

No you just have to switch to next source (C-o or ).

Which-key also displays (or can be configured to display) in more than one column, showing more possibilities at once.

Yes but as long it is not able to narrow down candidates it still not as efficient as helm display, but this is just my opinion and preference.

But I still don't understand why people want to use both packages that do more or less the same thing.

-- Thierry

davidpiano commented 8 months ago

Disclaimer: I don't know well enough what I'm talking about. But I'll try:

When I type a prefix, it may be followed by a key to complete the command, but often it can be followed by another prefix. When I type C-c and then use helm-descbinds, the first thing it shows is a fully detailed list of every possible command that begins with C-c. The list is properly categorized of course, but if I don't know in advance what I'm looking for, I must "wade through" the entire list to find it. Helm-descbinds also shows every command as a member of some category, which increases the total number of categories (and thus the physical length of the list).

Which-key is visually different, because it shows fewer details, it uses columns, and it is able to hide things:

The effect for me is that when using which-key I spend less time looking at category headings, or choices I don't want, or choices I can't even use until the next step. Helm-descbinds is better, because it is more organized and more specific; but all this specifying and organizing takes up space, it takes more time to look at, and more time for me to make a decision. Which-key is worse (possibly less organized, certainly less specific), but also faster to look at (allowing faster decisions by the user), and uses screen space more efficiently.

Yes they both answer the same questions, but one of them doesn't answer until he finishes explaining exactly what he's doing, why he's doing it, and all the other things he can also do. :) We can truly say he is providing a better and more complete service by giving this information, but ...

rocha commented 8 months ago

@davidpiano that is a very good summary! I think that is what Spacemacs is trying to do by combining which-key and helm-descbinds. It uses the former for quick navigation and the latter for more detailed navigation. It even makes helm-descbinds accessible at the first level of the main which-key “menu”.

thierryvolpiatto commented 8 months ago

I have added a new var helm-descbinds-disable-which-key to allow enabling previous behavior, have a look. Thanks.

dankessler commented 8 months ago

Thanks @thierryvolpiatto ; this is perfect!

davidpiano commented 8 months ago

Thank you! Works fine here too.

dankessler commented 8 months ago

I think this issue can be closed now :)

thierryvolpiatto commented 8 months ago

Ok, thanks!