
Print page (with headings).
Chapter 5 Chapter 5. Emacs as a Work Environment Many of the everyday things you do from a command prompt can be done from within Emacs. You can execute commands, work with directories, and print files—all without leaving Emacs. Changing tasks is as simple as jumping between buffers. What's important about this? Of course, it's nice to be able to move between tasks easily. What's even more important is that you have the same editing environment no matter what you're doing: you can use all of the Emacs editing commands to work on a file, give shell commands, then start up Dired, the directory editor, to do some file maintenance. It is simple to move text from one window to another. You can execute a command and then use Emacs commands to cut and paste the results into a file. If you're trying to compile a program and keep getting error messages, you can save the interactive session as a file and confer with someone about the problem. Despite the many advantages of modern window systems, Emacs often provides the best way to integrate the many kinds of work you do daily. Much of the information in this chapter involves integration between Emacs and the operating system. Emacs is most commonly a Unix editor, so forgive us for a bias in that direction. But we are happy to report that for users of GNU Emacs on other platforms, integration with the operating system is still available; you can use shell mode to run commands and can edit directories with Dired. There's no reason to leave Emacs no matter what your platform is.

Customize using interactive interface.
Chapter 10

Start online help system.
Chapter 14 Chapter 14. The Help System Emacs has the most comprehensive help facility of any text editor—and one of the best such facilities of any program at all. In fact, the Emacs help facilities probably cut down the time it took for us to write this book by an order of magnitude, and they can help you immeasurably in your ongoing quest to learn more about Emacs. In this chapter, we describe Emacs help in the following areas: • The tutorial. • The help key ( C-h ) and Help menu, which allow you to get help on a wide variety of topics. • The help facilities of complex commands like query-replace and dired . • Navigating Emacs manuals and using the info documentation reader. • Completion , in which Emacs helps you finish typing names of functions, variables, filenames, and more. Completion not only saves you time and helps you complete names of functions you know about but can help you discover new commands and variables.
If you don't like the toolbar, you can hide it using a menu option (Options → Show/Hide → Toolbar), and choosing Options → Save Options. For more information, see Section 2.7at the end of Chapter 2.
The menu bar menu lists the options File, Edit, Options, Buffers, Tools, and Help; you can explore them to see what options are available.
In addition to navigating the menus using the mouse, Emacs now offers pop-up menus. In the Emacs window, hold down Ctrland click the right mouse button to pop up the Edit menu . [6]
You can access menus without a mouse using the keyboard. In this case, using keyboard commands is much more efficient than menus, but for completeness, we'll show you how to use the text-based menus. (If you prefer to use the mouse with Emacs but have access only to a text interface, see Chapter 13to learn how to download and install a version of Emacs that runs graphically on Unix, Linux, Mac OS X, or Windows.)
If your mouse does not work with the menus, press F10or M-`(a back quote, the single open quotation mark, located above the Tabkey in the upper-left corner of many keyboards) to access them.
Press: F10

Using text-based menus (Emacs 21.2 on Mac OS X Terminal application).
You can select text-based menu options in three ways:
• You can press Enterto select the default option that appears in the minibuffer. If you want a different one, press the up or down arrow key until the option you want appears and press Enter.
• You can type the letter preceding the option in the *Completions*
buffer. For example, type fto choose File.
• You can press PgUpto move to the *Completions*
buffer, then use the arrow keys to move to the option you want. Press Enter. (On Mac OS X, press Shift-PgUpinstead.)
After you select a menu option, choices for that menu appear. Repeat the process until you find the option you're looking for.
Just above the bottom of the window (on the second-to-last line), Emacs prints a lot of information about what it's doing. This line is called the mode line . At the beginning of the mode line, you may see some information about the coding system that Emacs is using for the file; usually you'll see just --:, indicating that there is no unusual encoding scheme in place. Near the left edge of the mode line, you may see two asterisks ( **
). These asterisks indicate that you've modified whatever you're editing. If you haven't made any changes, the asterisks won't be there. Next, Emacs prints the name of the buffer you are editing ( *scratch*
). Following this, Emacs shows where you are in the buffer—your position relative to the rest of the file and what line you are on ( L5
for line 5 in Figure 1-1). If you're at the beginning of the file, Emacs prints the word Top
; if you're at the end, it prints Bot
; if you're in the middle, it shows you a percentage (for example, 50%
means you're looking at the midpoint); and if the entire file is visible, Emacs prints the word All
. In parentheses following this is the editing mode or modes you are in, in this case Lisp Interaction
is the major mode (no minor modes are active). The scrollbar on the side of the window also indicates your position in the file. [7]
You will often work with several buffers simultaneously. In this case, each buffer has its own mode line, and when you switch buffers, the mode line reflects the state of the current buffer. Don't worry about this for now; just remember that every buffer has a mode line to describe it.
Below the mode line is the minibuffer . This is the area where Emacs echoes the commands you enter and where you specify filenames for Emacs to find, values for search and replace, and so on. It is also where Emacs displays error messages. If you find yourself stuck in the minibuffer, press C-gto get out again.
You're about to start learning some Emacs commands, so let's discuss them a bit first. How do you give commands? Each command has a formal name, which (if you're fastidious) is the name of a Lisp routine. Some command names are quite long; you usually wouldn't want to type the whole thing. As a result, we need some way to abbreviate commands.
Emacs ties a command name to a short sequence of keystrokes. This tying of commands to keystrokes is known as binding . Even things you don't normally think about as commands, such as inserting the characters that you type, are handled through the binding mechanism. Keys like "A" are bound to the Emacs command self-insert-command, which inserts them into the buffer you are editing. [8]Most actions that you would normally think of as editor commands are bound to keystroke sequences starting with Ctrlor Meta. Emacs also binds some commands to mouse clicks (alone or modified by Shiftor Ctrl) and to options on menus.
Читать дальше