Running Linux, 5th Edition - Matthias Kalle Dalheimer [359]
Each node also has a link to the parent node (Up), which here is (dir), meaning the Info page directory. Pressing u takes you to the parent node. In addition, each node has a link to the previous node, if it exists (in this case, it does not). The p command moves to the previous node. The l command returns you to the node most recently visited.
Within the Info reader, pressing ? gives you a list of commands, and pressing h presents you with a short tutorial on using the system. Since you're running Info within Emacs, you can use Emacs commands as well (such as C-x b to switch to another buffer).
If you think that the Info system is arcane and obsolete, please keep in mind that it was designed to work on all kinds of systems, including those lacking graphics or powerful processing capabilities.
Other online help is available within Emacs. Pressing C-h C-h gives you a list of help options. One of these is C-h k, after which you press a key, and documentation about the function that is bound to that key appears.
Deleting, Copying, and Moving Text
There are various ways to move and duplicate blocks of text within Emacs . These methods involve use of the mark, which is simply a "remembered" cursor location you can set using various commands. The block of text between the current cursor location (point) and the mark is called the region.
You can set the mark using the key C-@ (or C-Space on most systems). Moving the cursor to a location and pressing C-@ sets the mark at that position. You can now move the cursor to another location within the document, and the region is defined as the text between the mark and point.
Many Emacs commands operate on the region. The most important of these commands deal with deleting and yanking text . The command C-w deletes the current region and saves it in the kill ring. The kill ring is a list of text blocks that have been deleted. You can then paste (yank) the text at another location, using the C-y command. (Note that the semantics of the term yank differ between vi and Emacs. In vi, "yanking" text is equivalent to adding it to the undo register without deleting it, whereas in Emacs, "yank" means to paste text.) Using the kill ring, you can paste not only the most recently deleted block of text, but also blocks of text that were deleted previously.
For example, type the text shown in Figure 19-20 into an Emacs buffer.
Figure 19-20. Entering text into an Emacs buffer
Now, move the cursor to the beginning of the second line ("Here is a line..."), and set the mark with C-@. Move to the end of the line (with C-e), and delete the region using C-w. See Figure 19-21.
To yank the text just deleted, move the cursor to the end of the buffer and press C-y. The line should be pasted at the new location, as shown in Figure 19-22.
Figure 19-21. Emacs buffer after deletion
Figure 19-22. Emacs buffer after paste
Pressing C-y repeatedly will insert the text multiple times.
You can copy text in a similar fashion. Using M-w instead of C-w will copy the region into the kill ring without deleting it. (Remember that M- means holding down the Alt key or pressing Esc before the w.)
Text that is deleted using other kill commands, such as C-k, is also added to the kill ring. This means that you don't need to set the mark and use C-w to move a block of text; any command that deletes more than one character will do.
To recover previously deleted blocks of text (which are saved on the kill ring), use the command M-y after yanking with C-y. M-y replaces the yanked text with the previous block from the kill ring. Pressing M-y repeatedly cycles through the contents of the kill ring. This feature is useful if you wish to move or copy multiple blocks of text.
Emacs also provides a more general register mechanism, similar to that found in vi. Among other things, you can use this feature to save text you want to paste in later. A register has a one-character name; let's use a for this example:
At the beginning of the text you want to save, set the mark by