The keys listed in the *Help* are those that, when appended to your help key, run Emacs help commands at any time. Help commands fall into two general categories: those that provide answers to specific questions and those that give general information about Emacs.
You will find the help commands in the former category to be invaluable after you have become comfortable with Emacs. Because it is so large and functionally rich, there will be times when you need to look up a detail such as a keystroke or command name or when you need to do something with Emacs that you don't know exactly how to do. As we've repeated again and again throughout this book, Emacs probably does what you want; you just need to figure out how. The help commands let you find these things out immediately, without leaving Emacs and without being a slave to your reference manual (or even this book).
14.2.1 Detail Information
Let's start with the help commands that are useful when you need to look up a specific detail. You'll probably use the commands listed in Table 14-1 most often.
Table 14-1. Detail information help commands
| Keystrokes | Command name | Question answered |
|---|---|---|
| C-h c | describe-key-briefly | What command does this keystroke sequence run? |
| C-h k Help → Describe → Describe Key | describe-key | What command does this keystroke sequence run, and what does it do? |
| C-h f Help → Describe → Describe Function | describe-function | What does this function do? |
| C-h v Help → Describe → Describe Variable | describe-variable | What does this variable mean, and what is its value? |
| C-h m Help → Describe → Describe Buffer Modes | describe-mode | Tell me about the modes the current buffer is in. |
| C-h b Help → Describe → List Key Bindings | describe-bindings | What are all the key bindings for this buffer? |
| C-h w | where-is | What is the key binding for this command? |
| C-h s | describe-syntax | What is the syntax table for this buffer? |
| C-h l | view-lossage | What are the last 100 characters I typed? |
| C-h e | view-echo-area-messages | What messages have appeared in the minibuffer during this session? |
What if you press the wrong key, and something happens to your buffer—but you're not sure what? Usually, the safest thing to do is to press C-_ or C-x u (undo). But sometimes this command won't help, for example, a runaway replace-string. If you remember what you typed, you can use C-h c (for describe-key-briefly) to see what command was run; just retype the offending keystroke(s) at the prompt, and Emacs responds with the name of the command bound to the key(s) in the minibuffer. If the command name alone doesn't help, C-h k (for describe-key) pops up a *Help* window with a description of the command as well as its name and key binding. (C-h k and C-h c also help you find out what command a toolbar icon or menu item runs.)
However, if you don't know what keys you pressed, you can type C-h l (for view-lossage). This pops up a *Help* window showing the last 100 keystrokes you typed; the offending ones are likely near the end, and you can use C-h c or C-h k with those keystrokes.
Now suppose you want information on a command that isn't bound to keystrokes. Type C-h f (for describe-function) and enter the name of the command at the prompt; Emacs responds with a *Help* window containing the documentation for that command. If you remember the name of a command but forget its binding, type C-h w (for where-is). This is the "opposite" of C-h c; it shows the key binding for a given command in the minibuffer, or the message command-name is not on any keys if the command has no binding.
You may forget a detail that involves the value of a variable. For example, will Emacs respect or ignore case during a search (the variable case-fold-search)? How often are my buffers being auto-saved (the variable auto-save-interval)? If you type C-h v (for describe-variable) followed by the name of the variable, Emacs puts its value as well as its documentation in a *Help* window. C-h f, C-h w, and C-h v all allow you to use completion when typing command or variable names. C-h f and C-h v are also especially useful to Emacs Lisp programmers; note that C-h f gives you information on all functions, not just those bound to keystrokes as commands.
Another common help situation arises when you use a special mode, such as shell mode or a mode for a programming language or text processor, and you forget a command specific to that mode or some other characteristic such as indentation conventions. If you type C-h m (for describe-mode) in a buffer running the mode, Emacs pops up a *Help* window showing the mode's documentation. Documentation for a mode usually includes all of its local key bindings (for example, all the commands special to the mode and their associated keystrokes), customization variables, and other interesting characteristics.