[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4. Keys and Commands

This manual is full of passages that tell you what particular keys do. But Emacs does not assign meanings to keys directly. Instead, Emacs assigns meanings to named commands, and then gives keys their meanings by binding them to commands.

Every command has a name chosen by a programmer. The name is usually made of a few English words separated by dashes; for example, next-line or forward-word. A command also has a function definition which is a Lisp program; this is how the command does its work. In Emacs Lisp, a command is a Lisp function with special options to read arguments and for interactive use. For more information on commands and functions, see (elisp)What Is a Function section `What Is a Function' in The Emacs Lisp Reference Manual. (The definition here is simplified slightly.)

The bindings between keys and commands are recorded in tables called keymaps. See section Keymaps.

When we say that "C-n moves down vertically one line" we are glossing over a subtle distinction that is irrelevant in ordinary use, but vital for Emacs customization. The command next-line does a vertical move downward. C-n has this effect because it is bound to next-line. If you rebind C-n to the command forward-word, C-n will move forward one word instead. Rebinding keys is an important method of customization.

In the rest of this manual, we usually ignore this distinction to keep things simple. We will often speak of keys like C-n as commands, even though strictly speaking the key is bound to a command. Usually we state the name of the command which really does the work in parentheses after mentioning the key that runs it. For example, we will say that "The command C-n (next-line) moves point vertically down," meaning that the command next-line moves vertically down, and the key C-n is normally bound to it.

Since we are discussing customization, we should tell you about variables. Often the description of a command will say, "To change this, set the variable mumble-foo." A variable is a name used to store a value. Most of the variables documented in this manual are meant for customization: some command or other part of Emacs examines the variable and behaves differently according to the value that you set. You can ignore the information about variables until you are interested in customizing them. Then read the basic information on variables (see section Variables) and the information about specific variables will make sense.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Mark Kaminski on July, 3 2008 using texi2html 1.70.