O'Reilly logo

Learning GNU Emacs, Second Edition by Eric S. Raymond, Bill Rosenblatt, Debra Cameron

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Conventions Used in This Book

This section covers the conventions used in this book.

Emacs Commands

Emacs commands consist of a modifier, such as CTRL (CONTROL) or ESC (ESCAPE), followed by one or two characters. Commands shown in this book abbreviate CTRL to C:

C-g

Hold down the CTRL key and press g.

To complete a command you may need to press a carriage return:

RETURN

Press the RETURN key. (This key may be labeled ENTER on your keyboard.)

Most Emacs manuals refer to the META key in addition to the CTRL key. Since most keyboards don’t have a META key, this book refers to ESC instead of META:

ESC x

Press ESC, release it, then press x. [4]

It is entirely possible that your keyboard has a META key. On Sun workstations, the keys to the immediate right and left of the space bar are META keys. On many other keyboards, the ALT keys function as a META key. [5]If your keyboard does have a META key, it works like the CTRL key described here—that is, you hold down the META key and press the desired key, such as g. Since you can continue to hold down the META key for repeated keystroke sequences, META keys do have an advantage. ESC tends to be less convenient for repeated keystroke sequences. In general, if you have a META key on your keyboard, you will probably prefer to use it instead of ESC.

A few mouse commands (used only with the X Window System, discussed in Chapter 14 use the SHIFT key as a modifier, often in combination with the CTRL key. This is abbreviated as:

S-right

Press the right mouse button in combination with the SHIFT key.

C-S-right

Press the right mouse button in combination with the SHIFT and CTRL keys.

All Emacs commands, even the simplest ones, have a full name; for example, forward-word is equivalent to the keystrokes ESC f, and forward-char is equivalent to C-f. Some commands have only full names, with no corresponding keystrokes.

When we discuss a command, we’ll give both its full name and the keystrokes (if any) that you can type to invoke it. We will assume you are using the default bindings (the default assignment of keystrokes to Emacs commands).

Tables

To find a group of commands quickly, look for tables in each section that summarize commands. These tables are formatted like this:

Keystrokes

Command Name

Action

C-n

next-line

Move to the next line.

C-x C-f

find-file

Open a specified file.

FilesOpen File

  

(none)

yow

Print ineffable wisdom from the Pinhead in the minibuffer.

The first column shows the default key binding for the command, the second column shows the command’s full name, and the third column describes what the command does. For example, pressing C-n (also known as the next-line command) moves the cursor to the next line in the file. Some commands, like C-x C-f, can also be reached through menus. If there is a menu option for a particular command, it is given in italics below the keystrokes for the command. For example, you can use the find-file command by typing C-x C-f or by selecting Open File from the Files menu. Sometimes you’ll see (none) in the keystrokes column, which doesn’t mean you can’t use the command, but rather that the command isn’t bound to particular keystrokes. To use commands with no keystrokes, type ESC x, followed by the command’s full name, and press RETURN. (Try typing ESC x yow RETURN sometime.)

Examples

Throughout the book, you’ll find keystrokes to type, followed by an Emacs screen showing the results.

Type: emacs myfile

Examples

Type emacs with a filename at the UNIX prompt to start an Emacs session.

The word emacs is in bold, indicating that this is exactly what you type. myfile is shown in italics because you could substitute any filename you choose and need not type exactly what you see here. The cursor (the point at which you are currently editing) is shown in reverse video, as is the Emacs mode line at the bottom of the screen.

Toward the end of the book, when we’re discussing programming modes, customization, and LISP programming, showing a simulated Emacs screen becomes rather unwieldy. Therefore, we’ll eventually stop using displays like the one above; instead, we’ll show only one or two lines of text. If it’s relevant, we’ll show the cursor’s position with an underline:

/* This is a C comment */

Font Usage

This book uses the following font conventions:

  • UNIX commands, Emacs keystrokes, command names, menu options, and variables are shown in boldface type.

  • Filenames are shown in italic type.

  • Buffer names, LISP code, C code, Emacs messages, and other excerpts from programs are shown in constant width type.

  • Dummy parameters that you replace with an actual value are shown in italic type. (If they appear within a program, they are shown in constant width italic type.)



[4] We emphasize releasing ESC, because pressing it twice (ESC ESC) or holding it down a second too long so that it repeats gives you an error message in some versions of Emacs 19. If you encounter this problem, see Section 2.7.4 for a solution.

[5] If you use Emacs remotely, pressing ALT may sever the connection. This problem is relatively rare, but we thought you might want to know.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required