Выбрать главу

You may have noticed that several modes, including paragraph indent text mode, outline mode, and compilation mode, are both major and minor modes. Each can be used alone—as a major mode—or with another major mode as a minor mode.

There are many other modes that we won't discuss, including modes for some obscure but interesting programming languages (like Modula-2). There are also some other modes that Emacs uses itself, like Dired mode for the directory editing feature (described in Chapter 5).

In addition, if you're good at Lisp programming, you can add your own modes. Emacs is almost infinitely extensible.

1.4 Starting Emacs

To start Emacs, simply click on the Emacs icon or type emacs on the command line and press Enter.[5]

Click on the Emacs icon or, from the command line, type: emacs Enter

Starting Emacs.

You'll see a short message describing a few important menu items and the version of Emacs that you're running. It may appear as a graphical splash screen (like the one shown here) or a text splash screen. This message disappears as soon as you type the first character. Emacs then puts you in an (almost) empty buffer called *scratch*, an ideal place for you to experiment.

1.5 About the Emacs Display

When you enter Emacs, you see a large workspace near the top of the window where you do your editing. (See Figure 1-1.)

Figure 1-1. Understanding the Emacs display

A cursor marks your position. The cursor is also called point, particularly among people who are more familiar with Emacs and in the online help system; therefore, it's useful to remember this term.

You don't have to do anything special before you start typing. As long as you type alphanumeric characters and punctuation, Emacs inserts them into your buffer. The cursor indicates where Emacs inserts the new characters; it moves as you type. Unlike many editors (particularly vi), Emacs does not have separate modes for inserting text and giving commands. Try typing something right now, and you'll begin to see how easy Emacs is to use. (If you get stuck for any reason, just press C-g.)

1.5.1 The Toolbar

The toolbar is a new feature in Emacs 21. Its basic icons and their functions are listed in Table 1-3. Note that the toolbar is context sensitive; in some modes, such as the Info mode for reading the Emacs manual, the toolbar changes to provide browsing help. We'll discuss those icons when we cover the relevant modes.

Table 1-3. Icons on the Emacs toolbar

Icon Function Where to learn more

Find a file or create a new file (supplying the filename).

This chapter

Start the directory editor so you can manipulate files and folder.

Chapter 5

Kill the current buffer.

Chapter 4

Save current buffer in its associated file.

This chapter

Save current buffer as a different file.

This chapter

Undo.

Chapter 2

вернуться

5

How you start Emacs may vary by platform. Linux has no icon on the desktop by default; Windows and Mac OS X do (if you've installed Emacs on these platforms). Note that Mac OS X comes with a version of GNU Emacs installed in /usr/bin, and that is what runs by default when you start up Emacs using the Terminal application. You won't be able to use the mouse at all if you run Emacs in the Terminal application, and there are a number of other limitations as well. Better versions of GNU Emacs are available to you; see Chapter 13 for details.