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

embark-which-key-indicator cannot handle paging #707

Open
richcarl opened this issue Mar 19, 2024 · 5 comments
Open

embark-which-key-indicator cannot handle paging #707

richcarl opened this issue Mar 19, 2024 · 5 comments

Comments

@richcarl
Copy link
Contributor

I was hoping that I could get the C-h paging in which-key to work with Embark via the embark-which-key-indicator from the Wiki (https://github.com/oantolin/embark/wiki/Additional-Configuration#use-which-key-like-a-key-menu-prompt) by doing (setq embark-help-key "?") to leave C-h free for which-key.

I found that the indicator function in the Wiki passes t for the no-paging argument in the call to which-key--show-keymap, and I tried to change that to nil to allow which-key to react to the paging keypress. This works on the which-key side, but once you have pressed e.g. C-h n to page forward and the call returns, I got "Error running timer: (error "embark-next-symbol is not a keymap"), and I'm not good enough at elisp to see what's going on. Maybe someone else can figure out how to fix this so that the which-key indicator function can do paging; it would be nice to have.

@oantolin
Copy link
Owner

I'd love to have this working, but I never was able to figure it out myself. I don't use which-key so I also didn't spend a ton of time on it, but I did try for a while.

@oantolin
Copy link
Owner

In the meantime, might I suggest trying embark-minimal-indicator and if you need a reminder of the key bindings, pressing embark-help-key (C-h by default)? I find that much more convenient that either the verbose or the which-key indicators. If you use Vertico, you can even make the display very which-key-like with:

(cl-pushnew '(embark-keybinding grid) vertico-multiform-categories)

You can select a command by completion (and you can complete on either the command name or the string form of the key binding), or, if you press @, you can then type the key binding itself.

@richcarl
Copy link
Contributor Author

embark-minimal-indicator + embark-help-key with Vertico grid layout was a great suggestion! I hadn't discovered vertico-multiform-mode until now.

@oantolin
Copy link
Owner

I'm glad you liked that suggestion. It's also related to what I use instead of which-key generally:

(setq prefix-help-command #'embark-prefix-help-command)

With that configuration pressing C-h after a prefix pops embark's completing-read prompter in the minibuffer, listing the command under the prefix and their bindings. (It's just like pressing embark-help-key during embark-act but for arbitrary prefixes.)

Personally, I like this a lot more than which-key for several reasons:

  1. The main reason is completion: I can type a few characters to narrow the list of commands to just the ones I want to see. In which-key I find it annoying and wasteful to have to page through and reading everything: surely the computer should be in charge of narrowing the list of commands, not my poor addled brain?

  2. I like the grid view which is very which-key-like, but I can also switch Vertico to a vertical list (with M-G or M-V) and then I get the first line of each docstring as a Marginalia annotation, which is great for exploration or for confirming I have the right command name.

  3. I can act on the candidates with Embark; for example, I often read the documentation of a couple of commands (with C-. h, since I bind embark-act to C-.), or I sometimes narrow the command list a bit and then use embark-export to get a nice apropos-mode buffer listing all commands with a bit of documentation, that I can peruse at my leisure.

  4. This probably not a common preference, but I much prefer summoning help than having it popup automatically.

@richcarl
Copy link
Contributor Author

I had already enabled the embark-prefix-help-command, as the docs recommended, but haven't yet got into the habit of using it. You're right that it's good to summon help when needed. So far I have liked the timer based help in which-key, so that if I suddenly forget which key to press next it just pops up after a while and with any luck I'll see the key I wanted on the first page. But with the nice grid layout in Embark, I might drop which-key completely once I learn to press C-h instead. (I've been an Emacs user for 30 years, and only now did I learn that you could use C-h after a prefix key.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants