0

When you use Helm for M-x, you can quickly check the documentation for an interactive command before calling it, it using the secondary key (usually C-z or C-j; I use the latter below). It brings up a background help buffer so you can be sure this is the command you want and you know how any arguments are used. Helm’s help line shows this: C-j: Describe this command (keeping session).

It’s a fantastic quality-of-life feature. Unfortunately, it only works for interactive commands; not for non-interactive functions or variables.

When you use describe-function (C-h f) or describe-variable (C-h v), this functionality goes away, replaced by nothing. (Literally: the Helm help line reads C-j: DoNothing (keeping session).)

I think I understand the motivation for this design: since you’re in the middle of running the interactive command to describe a function or variable, the alternate function also describing the function or variable seems redundant.

But in reality, when I’m doing Elisp coding, I frequently have used Helm to narrow down my choices of functions or variables to a manageable, but still significant number (say, eight or ten) and I’m not sure which one I want.

I’d like to press my secondary key on each to “preview” its documentation¹ before picking the one I want. But instead, my only avenue seems to be using RET to complete the describe command, then repeating the search with C-h f M-p and navigating to the next one, and so on. (If the thing I’m looking for is a buffer-local variable whose value I’m interested in, that requires even a few more keystrokes.)

If you have a number of choices and you really have no idea which one is right, it’s easy to lose track of your place (particularly after you’ve looked at a few) and repeat one you’ve already looked at—or inadvertently skip one—since you have to start at the top of the list again each time.

In Helm’s GitHub issues, there was a query about this, but the solution proposed—of simply assigning the describe function to the secondary key—results in an (interruptible) hang from infinite recursion.

So how can I achieve this?


¹ A “preview” sounds like I may want something different from what you get from the description—a synopsis (as you can get from interactives’ doc strings). But I just want to see the description in another buffer while keeping the Helm session open.

1

You should use M-x helm-apropos (in the helm-elisp.el library), which you can use to describe commands, functions, variables and faces. Pressing C-j shows a preview of the documentation.

| improve this answer | |
  • Huh! I always thought of apropos as like, “an amalgam of describe-* functions”, so just assumed the Helm version would just work the same as the Helm versions of describe-function and describe-variable. I never thought to try it—so feeling dumb now, but thank you! – Trey Aug 16 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.