Marking Text to Delete, Move, or Copy
What if the text you want to delete is just a phrase? Or half a paragraph? Or several paragraphs? In Emacs, you select text by defining an area called a region. You can mark regions with the mouse or by using the keyboard. What happens with the mouse is a bit complicated, so we describe it later in this chapter, following our discussion of the system clipboard.
To define a region using the keyboard, you use a secondary pointer called a mark. Some versions of Emacs display the mark on the screen; unfortunately, in GNU Emacs, the mark is invisible.
You set the mark at one end of the region by pressing C-Space or C-@, then move the cursor to the other end of the region. (The cursor is sometimes also referred to as point. There is one minor but important difference between the cursor and the point, however. The cursor is on top of a character; in Emacs, the point is actually in between the character the cursor is on and the previous character. As we said, this difference is minor, but it helps you to visualize where the cursor should be when you mark a region.) Figure 2-5 illustrates point, mark, and region.
Figure 2-5. Point, mark, and region
Let's mark a sample region. In this example, we remove the phrase "it was the worst of times." First, we find the beginning of the phrase. Then we set the mark, move forward to the end of the phrase, and ...
Get Learning GNU Emacs, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.