Sams Teach Yourself Emacs in 24 Hours |  | ContentsIndex
Hour 3: Getting Started with Emacs |  | Previous HourNext Hour
Sections in this Hour: |  |

## Hour 3
Getting Started with Emacs

Before you can learn everything worth knowing about Emacs, it is necessary to learn a few concepts about Emacs. This is necessary for two reasons:

- Emacs is very different from word processors or even other editors. If you do not realize this, you will find Emacs hard to understand and hard to learn. It isn't; it is simply different (and much more powerful).

- When you have learned the basic concepts, it is much easier to understand the different parts of Emacs. (Think of a car: It is very hard to tell someone how the engine works if that person doesn't realize that a car can move by itself!)

Caution - Do not skip this hour (not even if you are a little familiar with Emacs), because it contains much information required by the other hours. If you skip it, you'll find the other hours difficult or even impossible. Keep up--after all, this is a very short hour.

First you will start by looking at what you see when you start Emacs and what you find in the menus. Later, I'll introduce you to the vocabulary used when talking about Emacs.

## Layout of the Screen

When you start Emacs, you see a window, which looks like either Figure 3.1 or Figure 3.2, depending on whether you are using GNU Emacs or XEmacs.

Caution - If you are using Emacs version 19, this window might be a bit different from the one you would see in version 20.

Windows Notes - GNU Emacs on Windows looks very much like the UNIX screen illustration in Figure 3.1.

Figure 3.1
The GNU Emacs start-up window.

The menu bar, located at the top of the window, is where many of the functions in Emacs are located. This is a perfect location to start when you want to investigate Emacs on your own. Many functions available from the menu bar are also available on the keyboard. In these cases the keybinding is shown in the menu bar. This should make it easier for you to get used to using the keyboard whenever possible.

Figure 3.2
The XEmacs startup window.

Below the XEmacs menu bar is a toolbar.

Next is the actual location where you edit your files and, believe me, I'll talk about this a lot more. Beside it is a scrollbar, with which you can scroll through the text. In XEmacs and in GNU Emacs in Windows, this scrollbar looks like one you might know from any application. In GNU Emacs in UNIX, however, the scrollbar is a bit different. If you press on it with the first mouse button (most often the left one on your mouse), the text scrolls one window down. Pressing on it with the third mouse button (likely to be the right one on your mouse) scrolls the window one page up. Finally, pressing the second mouse button (likely to be the middle one) scrolls the file to this location. That is, if you press 25% from the top of the scrollbar, Emacs scrolls 25% down in the text. This is, in fact, how the scrollbar works in XTerm too.

Tip - If your mouse has only two buttons and you are using Linux, there is still hope! Your X setup can be configured so that pressing both mouse buttons at the same time makes Emacs think that the (missing) middle mouse button was pressed.

The second-to-last line (the one in inverse video) is called the mode-line. This line is a status line, which contain different kinds of information about the status of Emacs. Different kinds of information are located in this line, but it always contains at least the following:

- Status information-- This tells you the state of your file with two characters. (In GNU Emacs, these are the two characters after the colon.) It includes certain combinations. -- indicates that the content which Emacs shows is equal to the content of the file on disk, and that you are allowed to edit it. ** indicates that the file has changed in Emacs and has not been synchronized with the version on disk (that is, it has not been saved to disk). %% indicates that the file is not editable (that is, the file is write-protected on disk). Finally, %* indicates that the file is write-protected on disk, but you nevertheless have managed to edit it. (You need to take special actions to be allowed to edit a file in Emacs that is write-protected on disk!)

- The name of the buffer -- The word buffer is the name for the entity you are editing. (In most cases, a buffer corresponds to a file, but this is not always true.) This will be discussed shortly (see "Buffers, Windows, and Frames"). The name of the buffer in the screen dumps is *scratch*.

- The major and minor modes enabled-- Major and minor modes are discussed shortly.

- Line number -- In GNU Emacs the line number is by default shown in the mode-line, but it isn't in XEmacs.

- Percentage of text shown-- Finally information is given about which part of the text is shown. This might be All to indicate that you see all the text, Top to indicate that you are viewing the top of the text, Bot to indicate that you are looking at the bottom of the text, or, say, 27% to indicate that the first line onscreen is 27% from the top.

The last line of the screen is the minibuffer. This is the area where Emacs asks questions such as Buffer modified; kill anyway? (Yes or no). likewise, Emacs might show information to you in this area. The minibuffer is discussed later in this hour.

Sams Teach Yourself Emacs in 24 Hours |  | ContentsIndex
Hour 3: Getting Started with Emacs |  | Previous HourNext Hour
Sections in this Hour: |  |

© Copyright Macmillan USA. All rights reserved.