Running Linux, 5th Edition - Matthias Kalle Dalheimer [358]
Figure 19-17. Emacs buffer after entering text
question, it will tell you that modified buffers still exist and ask whether you really want to quit without saving changes to those buffers.
You can use C-x C-s to save the current file, and C-x C-f to find another file to edit. For example, typing C-x C-f presents you with a prompt such as:
Find file: /home/loomer/mdw/
where the current directory is displayed. After this, type the name of the file to find. Pressing the Tab key will do filename completion similar to that used in bash and zsh. For example, entering:
Find file: /home/loomer/mdw/.bash
and pressing Tab opens another buffer, showing all possible completions, as in Figure 19-18.
Figure 19-18. Completions buffer in Emacs
After you complete the filename, the *Completions* buffer goes away and the new file is displayed for editing. This is one example of how Emacs uses temporary buffers to present information. If you do not want to use the current directory, instead of deleting everything that's there, you can just append another slash to the displayed path and start over afresh, without having to delete the existing text.
Emacs allows you to use multiple buffers when editing text; each buffer may contain a different file you're editing. When you load a file with C-x C-f, a new buffer is created to edit the file, but the original buffer isn't deleted.
You can switch to another buffer using the C-x b command, which asks you for the name of the buffer (usually the name of the file within the buffer). For example, pressing C-x b presents the following prompt:
Switch to buffer: (default wibble.txt)
The default buffer is the previous one visited. Press Enter to switch to the default buffer, or type another buffer name. Using C-x C-b will present a buffer list (in a buffer of its own), as shown in Figure 19-19.
Figure 19-19. Buffer list in Emacs
Popping up the buffer menu splits the Emacs screen into two "windows," which you can switch between using C-x o. More than two concurrent windows are possible as well. In order to view just one window at a time, switch to the appropriate one and press C-x 1. This hides all the other windows, but you can switch to them later using the C-x b command just described. Using C-x k actually deletes a buffer from Emacs's memory.
Tutorial and Online Help
Already Emacs looks a bit complex; that is simply because it's such a flexible system. Before we go any further, it is instructive to introduce Emacs's built-in online help and tutorial. This documentation has also been published in book form as the GNU Emacs Manual, by Richard M. Stallman (GNU Press).
Using the C-h command gives you a list of help options on the last line of the display. Pressing C-h again describes what they are. In particular, C-h followed by t drops you into the Emacs tutorial. It should be self-explanatory, and an interactive tutorial about Emacs tells you more about the system than we can hope to cover here.
After going through the Emacs tutorial, you should get accustomed to the Info system, where the rest of the Emacs documentation resides. C-h followed by i enters the Info reader. A mythical Info page might look like this:
File: intercal.info, Node: Top, Next: Instructions, Up: (dir)
This file documents the Intercal interpreter for Linux.
* Menu:
* Instructions:: How to read this manual.
* Overview:: Preliminary information.
* Examples:: Example Intercal programs and bugs.
* Concept Index:: Index of concepts.
As you see, text is presented along with a menu to other nodes. Pressing m and then entering a node name from the menu will allow you to read that node. You can read nodes sequentially by pressing the spacebar, which jumps to the next node in the document (indicated by the information line at the top of the buffer). Here, the next node is Instructions, which is