next up previous
Next: Important special-purpose commands Up: Highlights of GNU Emacs Previous: Highlights of GNU Emacs

Basic Concepts

At any given time, Emacs maintains one or more buffers containing text. Each buffer may, but need not, be associated with a file. A buffer may be associated with a UNIX process, in which case the buffer generally contains input and output produced by that process (see, for example, sections [*] and [*]). Within each buffer, there is a position called the point, where most of the action takes place.

Emacs displays one or more windows into its buffers, each showing some portion of the text of some buffer. A buffer's text is retained even when no window displays it; it can be displayed at any time by giving it a window. Each window has its own point (as just described); when only one window displays a buffer, its point is the same as the buffer's point. Two windows can simultaneously display text (not necessarily the same text) from the same buffer with a different point in each window, although it is most often useful to use multiple windows to display multiple files. At the bottom of each window, Emacs displays a mode line, which generally identifies the buffer being displayed and (if applicable) the file associated with it. At any given time, the cursor, which generally marks the point of text insertion, is in one of the windows (called the current window) at that window's point.

At the bottom of Emacs' display is a single echo area, displaying the contents of the minibuffer. This is a one-line buffer in which one types commands. It is, for many purposes, an ordinary Emacs buffer; standard Emacs text-editing commands for moving left or right and for inserting or deleting characters generally work in it. To issue a command by name, one types M-x (``meta-x''; this notation is described below) followed by the name of the command and RET (the return key); the echo area displays the command as it is typed. It is only necessary to type as much of the command name as suffices to identify it uniquely. For example, to run the command for looking at a UNIX manual entry--for which the full command is M-x manual-entry--it suffices to type M-x man, followed by a RET.

All Emacs commands have names, and you can issue them with M-x. You'll invoke most commands, however, by using control characters and escape sequences to which these commands are bound. Almost every character typed to Emacs actually executes a command. By default, typing any of the printable characters executes a command that inserts that character at the cursor. Many of the control characters are bound to commonly-used commands (see the quick-reference guide at the end for a summary of particularly important ones). At any time, it is possible to bind an arbitrary key or sequence of keys to an arbitrary command, thus customizing Emacs to your own tastes. Hence, all descriptions of key bindings in this document are actually descriptions of standard or default bindings.

In referring to non-graphic keys (control characters and the like), we'll use the following notations.

denotes the escape character.

denotes the delete character. On HP workstations, the `Backspace' key has the same effect.

denotes the space character.

denotes the result of pressing the `Return' key. (Confusingly, the result of typing this into a file is not a return character (ASCII code 13), but rather a linefeed character (ASCII code 10). Nevertheless, Emacs distinguishes the two keys.)

denotes the result of typing the linefeed key.

denotes the tab (also C-i) key.

denotes the result of control-shifting a character x.

denotes the result of meta-shifting a character 2#2 (on our HP workstations when running the X window system, either `Alt' key serves as a meta-shift key; it is held down while typing x). Alternatively, one may type M-2#2 as the two-character sequence ESC followed by 2#2.

denotes the result of simultaneously control- and meta-shifting x (on HP workstations when running X, hold down the Alt and Control keys simultaneously with typing 2#2). Alternatively, one may type ESC C-2#2.

The binding of keys to commands depends on the buffer that currently contains the cursor. This allows different buffers to respond to characters in different ways. In this document, we will refer to the set of key bindings in effect within a given buffer as the (major) mode of that buffer (the term ``mode'' is actually somewhat ill-defined in Emacs). There are certain standard modes that are described in section [*].

Certain commands take arguments, and take these arguments from a variety of sources. Any command may be given a numeric argument. To enter the number comprising the digits 3#3 as a numeric argument (d0 may also be a minus sign), type either `M- 3#3' or `C-u 3#3' before the command. When using C-u, the digits may be omitted, in which case `4' is assumed. The most common use for numeric arguments is as repetition counts. Thus, M-4 C-n moves down four lines and M-72 * inserts a line of 72 asterisks in the file. Other commands give other interpretations, as described below. In describing commands, we will use the notation ARG to refer to the value of the numeric argument, if present.

When commands prompt for arguments, Emacs will often allow provide a completion facility. When entering a file name on the echo line, you can usually save time by typing TAB, which fills in as much of the file name as possible, or SPC which fills in as much as possible up to a punctuation mark in the file name. Here, ``as much as possible'' means as much as is possible without having to guess which of several possible names you must have meant. A similar facility will attempt to complete the names of functions or buffers that are prompted for in the echo line.

next up previous
Next: Important special-purpose commands Up: Highlights of GNU Emacs Previous: Highlights of GNU Emacs
David Wolfe