Next: , Previous: , Up: Mark   [Contents][Index]

9.1.1 Setting the Mark

Here are some commands for setting the mark:


Set the mark where point is (set-mark-command).


The same.

C-x C-x

Interchange mark and point (exchange-point-and-mark).


Pushes a mark at the beginning of the buffer.


Pushes a mark at the end of the buffer.

For example, to convert part of the buffer to all upper-case, you can use the C-x C-u (upcase-region) command, which operates on the text in the region. First go to the beginning of the text you want to capitalize and type C-SPC to put the mark there, then move to the end, and then type C-x C-u to capitalize the selected region. You can also set the mark at the end of the text, move to the beginning, and then type C-x C-u. Most commands that operate on the text in the region have the word region in their names.

The most common way to set the mark is with the C-SPC command (set-mark-command). This command sets the mark where point is. You can then move point away, leaving the mark behind. It is actually incorrect to speak of the character C-SPC; there is no such character. When you type SPC while holding down CTRL, you get the character C-@ on most terminals. This character is actually bound to set-mark-command. But unless you are unlucky enough to have a terminal where typing C-SPC does not produce C-@, you should think of this character as C-SPC.

Since terminals have only one cursor, Emacs cannot show you where the mark is located. Most people use the mark soon after they set it, before they forget where it is. But you can see where the mark is with the command C-x C-x (exchange-point-and-mark) which puts the mark where point was and point where the mark was. The extent of the region is unchanged, but the cursor and point are now at the previous location of the mark.

Another way to set the mark is to push the mark to the beginning of a buffer while leaving point at its original location. If you supply an argument to C-< (mark-beginning-of-buffer), the mark is pushed n/10 of the way from the true beginning of the buffer. You can also set the mark at the end of a buffer with C-> (mark-end-of-buffer). It pushes the mark to the end of the buffer, leaving point alone. Supplying an argument to the command pushes the mark n/10 of the way from the true end of the buffer.

If you are using SXEmacs under the X window system, you can set the variable zmacs-regions to t. This makes the current region (defined by point and mark) highlight and makes it available as the X clipboard selection, which means you can use the menu bar items on it. See Active Regions, for more information.

C-x C-x is also useful when you are satisfied with the location of point but want to move the mark; do C-x C-x to put point there and then you can move it. A second use of C-x C-x, if necessary, puts the mark at the new location with point back at its original location.

Next: , Previous: , Up: Mark   [Contents][Index]