[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Here are some commands for setting the mark:
set-mark-command
).
exchange-point-and-mark
).
mouse-save-then-kill
).
For example, suppose you wish to convert part of the buffer to
upper case, using the C-x C-u (upcase-region
) command,
which operates on the text in the region. You can first go to the
beginning of the text to be capitalized, type C-SPC to put
the mark there, move to the end, and then type C-x C-u. Or, you
can set the mark at the end of the text, move to the beginning, and then
type C-x C-u.
The most common way to set the mark is with the C-SPC command
(set-mark-command
). This sets the mark where point is. Then you
can move point away, leaving the mark behind.
There are two ways to set the mark with the mouse. You can drag mouse button one across a range of text; that puts point where you release the mouse button, and sets the mark at the other end of that range. Or you can click mouse button three, which sets the mark at point (like C-SPC) and then moves point (like Mouse-1). Both of these methods copy the region into the kill ring in addition to setting the mark; that gives behavior consistent with other window-driven applications, but if you don't want to modify the kill ring, you must use keyboard commands to set the mark. See section P.1 Mouse Commands for Editing.
Ordinary terminals have only one cursor, so there is no way for Emacs
to show you where the mark is located. You have to remember. The usual
solution to this problem is to set the mark and then use it soon, before
you forget where it is. Alternatively, 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 position of the mark. In Transient Mark mode, this command
reactivates the mark.
C-x C-x is also useful when you are satisfied with the position of point but want to move the other end of the region (where the mark is); do C-x C-x to put point at that end of the region, and then move it. Using C-x C-x a second time, if necessary, puts the mark at the new position with point back at its original position.
For more facilities that allow you to go to previously set marks, see H.5 The Mark Ring.
There is no such character as C-SPC in ASCII; when you
type SPC while holding down CTRL, what you get on most
ordinary terminals is the character C-@. This key 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 might as well think of this character as
C-SPC. Under X, C-SPC is actually a distinct
character, but its binding is still set-mark-command
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |