Previous: , Up: Keystrokes   [Contents][Index]

2.3 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 functions, and then gives keys their meanings by binding them to functions.

A function is a Lisp object that can be executed as a program. Usually it is a Lisp symbol that has been given a function definition; every symbol has a name, usually made of a few English words separated by dashes, such as next-line or forward-word. It also has a definition, which is a Lisp program. Only some functions can be the bindings of keys; these are functions whose definitions use interactive to specify how to call them interactively. Such functions are called commands, and their names are command names. More information on this subject will appear in the SXEmacs Lisp Reference Manual.

The bindings between keys and functions are recorded in various tables called keymaps. See Key Bindings, for more information on key sequences you can bind commands to. See Keymaps, for information on creating keymaps.

When we say “C-n moves down vertically one line” we are glossing over a distinction that is irrelevant in ordinary use but is vital in understanding how to customize Emacs. The function next-line is programmed to move down vertically. C-n has this effect because it is bound to that function. If you rebind C-n to the function forward-word then C-n will move forward by words instead. Rebinding keys is a common method of customization.

The rest of this manual usually ignores this subtlety to keep things simple. To give the customizer the information needed, we often state the name of the command that 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 next-line is a command that moves vertically down and C-n is a key that is standardly bound to it.

While we are on the subject of information for customization only, it’s a good time to 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 remember a value. Most of the variables documented in this manual exist just to facilitate customization: some command or other part of Emacs uses the variable and behaves differently depending on its setting. Until you are interested in customizing, you can ignore the information about variables. When you are ready to be interested, read the basic information on variables, and then the information on individual variables will make sense. See Variables.

Previous: , Up: Keystrokes   [Contents][Index]