4

When someone use the Emacs inbuild help via C-h she/he has to know and understand if the object of interest is a function (C-h f), a variable (C-h v), a package (C-h p) or something else.

The differences between these types are unknown for new users.

Isn't there a magic package out there that can check this by itself and do the right thing? E.g. C-h x or C-h h.

2
  • 1
    Well, there's C-h o. I'm not sure if it qualifies as magic, but it's useful!
    – aadcg
    Commented Nov 13, 2021 at 14:56
  • 1
    @aadcg: Please consider adding that as an answer.
    – Drew
    Commented Nov 13, 2021 at 17:37

3 Answers 3

6

As @Drew mentions, the apropos commands are extremely important. The word derives from the French "à-propos" which can be translated as "in connection", "with regard" or "concerning". In other words, apropos foo means concerning foo.

In practice, I frequently use describe-symbol, bound to C-h o by default, since it describes variables, functions and faces.

Emacs' help system is advanced and it may take some time to wrap one's head around it. When in doubt, run C-h C-h for a description of all help commands.

5
  1. The apropos commands are your friend. Command apropos is the most general:

apropos is an autoloaded interactive Lisp function in apropos.el.

It is bound to <menu-bar> <help-menu> <search-documentation> <find-any-object-by-name>.

(apropos PATTERN &optional DO-ALL)

Probably introduced at or before Emacs version 1.8.

Show all meaningful Lisp symbols whose names match PATTERN.

Symbols are shown if they are defined as functions, variables, or faces, or if they have nonempty property lists.

PATTERN can be a word, a list of words (separated by spaces), or a regexp (using some regexp special characters). If it is a word, search for matches for that word as a substring. If it is a list of words, search for matches for any two (or more) of those words.

With C-u prefix, or if apropos-do-all is non-nil, consider all symbols (if they match PATTERN).

Returns list of symbols and documentation found.

  1. C-h S looks up a symbol in the manuals:

C-h S runs the command info-lookup-symbol (found in global-map), which is an autoloaded interactive Lisp function in info-look.el.

It is bound to C-h S, <f1> S, <help> S.

(info-lookup-symbol SYMBOL &optional MODE)

Probably introduced at or before Emacs version 20.1.

Display the definition of SYMBOL, as found in the relevant manual.

When this command is called interactively, it reads SYMBOL from the minibuffer. In the minibuffer, use M-n to yank the default argument value into the minibuffer so you can edit it. The default symbol is the one found at point.

With prefix arg MODE a query for the symbol help mode is offered.

2
  • 1
    What is a "symbol"?
    – buhtz
    Commented Nov 24, 2021 at 7:52
  • @buhtz: In this case, more or less a name that matches the regexp [a-z]+\\s +\\([_a-zA-Z][_a-zA-Z0-9]*\\)
    – Drew
    Commented Nov 24, 2021 at 19:04
2

Package helpful provides helpful-callable, for which you don't need to know whether the thing you're inquiring about is a command, function, or macro because it checks them all, and also helpful-symbol, which like describe-symbol mentioned previously will

Show help for SYMBOL, a variable, function or macro.

…by evaluating SYMBOL and calling helpful-callable or helpful-variable as appropriate (and asking which you want if it could be either—though unlike with describe-symbol you have to pick one, you don't get both).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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