annotate doc/emacs/mark.texi @ 99219:02d6a98205f0

(Using Region): Document use-empty-active-region.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 29 Oct 2008 16:00:42 +0000
parents 9c8e9543a90f
children da7dc901e0e6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1 @c This is part of the Emacs manual.
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002,
87903
5d58981e6690 Merge from emacs--rel--22
Miles Bader <miles@gnu.org>
parents: 84255
diff changeset
3 @c 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
4 @c See file emacs.texi for copying conditions.
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
5 @node Mark, Killing, Help, Top
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
6 @chapter The Mark and the Region
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
7 @cindex mark
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
8 @cindex setting a mark
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
9 @cindex region
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
10
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
11 Many Emacs commands operate on an arbitrary contiguous part of the
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
12 current buffer. To specify the text for such a command to operate on,
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
13 you set @dfn{the mark} at one end of it, and move point to the other
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
14 end. The text between point and the mark is called @dfn{the region}.
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
15
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
16 If the mark is active, the region always extends between point and
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
17 the mark, no matter which one comes earlier in the text; each time you
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
18 move point, the region changes. Whenever the mark is active, Emacs
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
19 highlights the region. You can customize the appearance of this
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
20 highlighting by changing the @code{region} face (@pxref{Face
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
21 Customization}).
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
22
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
23 The region persists only until you use it. The mark is
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
24 automatically @dfn{deactivated} after certain non-motion commands,
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
25 including any command that changes the text in the buffer. You can
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
26 also explicitly deactivate the mark at any time, by typing @kbd{C-g}
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
27 (@pxref{Quitting}).
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
28
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
29 @vindex highlight-nonselected-windows
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
30 Setting the mark in one buffer has no effect on the marks in other
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
31 buffers. When you return to a buffer with an active mark, the mark is
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
32 at the same place as before. When multiple windows show the same
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
33 buffer, they can have different values of point, and thus different
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
34 regions, but they all share one common mark position. @xref{Windows}.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
35 Ordinarily, only the selected window highlights its region; however,
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
36 if the variable @code{highlight-nonselected-windows} is
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
37 non-@code{nil}, each window highlights its own region.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
38
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
39 @menu
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
40 * Setting Mark:: Commands to set the mark.
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
41 * Marking Objects:: Commands to put region around textual units.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
42 * Using Region:: Summary of ways to operate on contents of the region.
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
43 * Mark Ring:: Previous mark positions saved so you can go back there.
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
44 * Global Mark Ring:: Previous mark positions in various buffers.
98678
9c8e9543a90f (Shift Selection): Correct case in node name.
Chong Yidong <cyd@stupidchicken.com>
parents: 96338
diff changeset
45 * Shift Selection:: Using shifted cursor motion keys.
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
46 * Persistent Mark:: Keeping the mark active all the time.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
47 @end menu
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
48
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
49 @node Setting Mark
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
50 @section Setting the Mark
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
51
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
52 Here are some commands for setting the mark:
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
53
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
54 @table @kbd
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
55 @item C-@key{SPC}
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
56 Set the mark at point (@code{set-mark-command}).
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
57 @item C-@@
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
58 The same.
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
59 @item C-x C-x
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
60 Set the mark at point, and move point where the mark was
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
61 (@code{exchange-point-and-mark}).
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
62 @item Drag-Mouse-1
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
63 Set point and the mark around the text you drag across.
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
64 @item Mouse-3
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
65 Set the mark at point, then move point to where you click
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
66 (@code{mouse-save-then-kill}).
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
67 @item @samp{Shifted motion keys}
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
68 Set the mark at point if the mark is inactive, then move point.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
69 @end table
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
70
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
71 @kindex C-SPC
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
72 @kindex C-@@
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
73 @findex set-mark-command
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
74 The most common way to set the mark is with @kbd{C-@key{SPC}}
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
75 (@code{set-mark-command}), which sets the mark where point
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
76 is@footnote{There is no @kbd{C-@key{SPC}} character in
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
77 @acronym{ASCII}; usually, typing @kbd{C-@key{SPC}} on a text terminal
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
78 gives the character @kbd{C-@@}. This key is also bound to
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
79 @code{set-mark-command}, so unless you are unlucky enough to have an
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
80 text terminal that behaves differently, you might as well think of
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
81 @kbd{C-@@} as @kbd{C-@key{SPC}}.}. You can then move point away,
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
82 leaving the mark behind.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
83
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
84 For example, suppose you wish to convert part of the buffer to upper
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
85 case. To accomplish this, go to the beginning of the desired text,
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
86 type @kbd{C-@key{SPC}}, and move point until the desired portion of
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
87 text is highlighted. Now type @kbd{C-x C-u} (@code{upcase-region}).
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
88 This converts the text in the region to upper case, and then
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
89 deactivates the mark.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
90
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
91 @kindex C-x C-x
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
92 @findex exchange-point-and-mark
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
93 The command @kbd{C-x C-x} (@code{exchange-point-and-mark}) exchanges
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
94 the positions of point and the mark, keeping the region unchanged. If
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
95 no mark is active, Emacs first reactivates the mark wherever it was
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
96 last set. @kbd{C-x C-x} is useful when you are satisfied with the
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
97 position of point but want to move the other end of the region (where
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
98 the mark is). Using @kbd{C-x C-x} a second time, if necessary, puts
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
99 the mark at the new position with point back at its original position.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
100
98678
9c8e9543a90f (Shift Selection): Correct case in node name.
Chong Yidong <cyd@stupidchicken.com>
parents: 96338
diff changeset
101 You can also set the mark with the mouse. If you press the left
9c8e9543a90f (Shift Selection): Correct case in node name.
Chong Yidong <cyd@stupidchicken.com>
parents: 96338
diff changeset
102 mouse button (@kbd{down-mouse-1}) and drag the mouse across a range of
9c8e9543a90f (Shift Selection): Correct case in node name.
Chong Yidong <cyd@stupidchicken.com>
parents: 96338
diff changeset
103 text while holding down this button, this sets the mark where you
9c8e9543a90f (Shift Selection): Correct case in node name.
Chong Yidong <cyd@stupidchicken.com>
parents: 96338
diff changeset
104 first pressed the mouse button and puts point where you release it.
9c8e9543a90f (Shift Selection): Correct case in node name.
Chong Yidong <cyd@stupidchicken.com>
parents: 96338
diff changeset
105 Alternatively, clicking the right mouse button (@kbd{mouse-3}) sets
9c8e9543a90f (Shift Selection): Correct case in node name.
Chong Yidong <cyd@stupidchicken.com>
parents: 96338
diff changeset
106 the mark at point and then moves point to where you clicked. Using
9c8e9543a90f (Shift Selection): Correct case in node name.
Chong Yidong <cyd@stupidchicken.com>
parents: 96338
diff changeset
107 the mouse to mark a region also copies the region into the kill ring
9c8e9543a90f (Shift Selection): Correct case in node name.
Chong Yidong <cyd@stupidchicken.com>
parents: 96338
diff changeset
108 (@pxref{Kill Ring}). @xref{Mouse Commands}, for a more detailed
9c8e9543a90f (Shift Selection): Correct case in node name.
Chong Yidong <cyd@stupidchicken.com>
parents: 96338
diff changeset
109 description of these mouse commands.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
110
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
111 @cindex shift-selection
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
112 Finally, you can set the mark by holding down the shift key while
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
113 typing certain cursor motion commands (such as @kbd{S-@key{right}},
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
114 @kbd{S-C-f}, @kbd{S-C-n}, etc.) This is referred to as
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
115 @dfn{shift-selection}. This sets the mark at point before moving
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
116 point, but only if there is no active mark set via shift-selection.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
117 The mark set by mouse commands and by shift-selection behaves slightly
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
118 differently from the usual mark: any subsequent unshifted cursor
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
119 motion command deactivates it automatically. For details, @xref{Shift
98678
9c8e9543a90f (Shift Selection): Correct case in node name.
Chong Yidong <cyd@stupidchicken.com>
parents: 96338
diff changeset
120 Selection}.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
121
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
122 Whenever the mark is active, you can deactivate it by typing
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
123 @kbd{C-g} (@pxref{Quitting}). The mark is also automatically
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
124 deactivated after certain non-motion commands.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
125
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
126 @node Marking Objects
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
127 @section Commands to Mark Textual Objects
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
128
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
129 @cindex marking sections of text
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
130 Here are the commands for placing point and the mark around a textual
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
131 object such as a word, list, paragraph or page:
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
132
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
133 @table @kbd
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
134 @item M-@@
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
135 Set mark after end of next word (@code{mark-word}). This does not
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
136 move point.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
137 @item C-M-@@
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
138 Set mark after end of following balanced expression
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
139 (@code{mark-sexp}). This does not move point.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
140 @item M-h
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
141 Move point to the beginning of the current paragraph, and set mark at
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
142 the end (@code{mark-paragraph}).
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
143 @item C-M-h
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
144 Move point to the beginning of the current defun, and set mark at the
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
145 end (@code{mark-defun}).
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
146 @item C-x C-p
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
147 Move point to the beginning of the current page, and set mark at the
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
148 end (@code{mark-page}).
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
149 @item C-x h
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
150 Move point to the beginning of the buffer, and set mark at the end
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
151 (@code{mark-whole-buffer}).
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
152 @end table
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
153
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
154 @findex mark-word
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
155 @findex mark-sexp
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
156 @kbd{M-@@} (@code{mark-word}) puts the mark at the end of the next
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
157 word, while @kbd{C-M-@@} (@code{mark-sexp}) puts it at the end of the
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
158 next balanced expression (@pxref{Expressions}). These commands handle
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
159 arguments just like @kbd{M-f} and @kbd{C-M-f}.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
160
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
161 @kindex C-x h
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
162 @findex mark-whole-buffer
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
163 The other commands in the above list set both point and mark, so as
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
164 to delimit an object in the buffer. @kbd{M-h} (@code{mark-paragraph})
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
165 moves point to the beginning of the paragraph that surrounds or
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
166 follows point, and sets the mark at the end of that paragraph
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
167 (@pxref{Paragraphs}). As a special exception, repeated invocations of
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
168 @kbd{M-h} extend the region to subsequent paragraphs. This is
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
169 convenient for indenting, case-converting, or killing entire
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
170 paragraphs.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
171
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
172 The @kbd{M-h} command accepts prefix arguments. If the argument's
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
173 value is positive, @kbd{M-h} marks that many paragraphs starting with
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
174 the one surrounding point; therefore, @kbd{C-u M-h} is equivalent to
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
175 @kbd{M-h M-h M-h M-h}. If the prefix argument is @minus{}@var{n},
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
176 @kbd{M-h} marks @var{n} paragraphs running back from the one
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
177 surrounding point; in this case, point moves forward to the end of
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
178 that paragraph, and the mark goes at the start of the region.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
179
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
180 Similarly, @kbd{C-M-h} (@code{mark-defun}) sets mark and point
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
181 around major top-level definitions (@pxref{Moving by Defuns}), and
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
182 @kbd{C-x C-p} (@code{mark-page}) does the same for pages
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
183 (@pxref{Pages}). These treat repeated invokations and prefix
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
184 arguments similarly to @code{mark-paragraph}.
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
185
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
186 Finally, @kbd{C-x h} (@code{mark-whole-buffer}) sets up the entire
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
187 buffer as the region, by putting point at the beginning and the mark
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
188 at the end. (In some programs this is called ``select all.'')
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
189
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
190 @node Using Region
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
191 @section Operating on the Region
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
192
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
193 @cindex operations on a marked region
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
194 Once you have a region, here are some of the ways you can operate on
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
195 it:
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
196
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
197 @itemize @bullet
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
198 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
199 Kill it with @kbd{C-w} (@pxref{Killing}).
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
200 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
201 Copy it to the kill ring with @kbd{M-w} (@pxref{Yanking}).
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
202 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
203 Convert case with @kbd{C-x C-l} or @kbd{C-x C-u} (@pxref{Case}).
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
204 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
205 Undo changes within it using @kbd{C-u C-/} (@pxref{Undo}).
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
206 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
207 Replace text within it using @kbd{M-%} (@pxref{Query Replace}).
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
208 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
209 Indent it with @kbd{C-x @key{TAB}} or @kbd{C-M-\} (@pxref{Indentation}).
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
210 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
211 Fill it as text with @kbd{M-x fill-region} (@pxref{Filling}).
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
212 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
213 Print hardcopy with @kbd{M-x print-region} (@pxref{Printing}).
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
214 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
215 Evaluate it as Lisp code with @kbd{M-x eval-region} (@pxref{Lisp Eval}).
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
216 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
217 Save it in a register with @kbd{C-x r s} (@pxref{Registers}).
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
218 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
219 Save it in a buffer or a file (@pxref{Accumulating Text}).
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
220 @end itemize
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
221
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
222 Most commands that operate on the text in the region have the word
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
223 @code{region} in their names.
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
224
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
225 If Delete Selection mode is enabled, some commands delete the region
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
226 when used while the mark is active. @xref{Mouse Commands}.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
227
99219
02d6a98205f0 (Using Region): Document use-empty-active-region.
Chong Yidong <cyd@stupidchicken.com>
parents: 98678
diff changeset
228 Some commands have a default behavior when the region is inactive,
02d6a98205f0 (Using Region): Document use-empty-active-region.
Chong Yidong <cyd@stupidchicken.com>
parents: 98678
diff changeset
229 but operate on the text in the region if the region is active. For
02d6a98205f0 (Using Region): Document use-empty-active-region.
Chong Yidong <cyd@stupidchicken.com>
parents: 98678
diff changeset
230 example, @kbd{M-$} (@code{ispell-word}) normally checks the spelling
02d6a98205f0 (Using Region): Document use-empty-active-region.
Chong Yidong <cyd@stupidchicken.com>
parents: 98678
diff changeset
231 of the word at point, but it checks the text in the region if the
02d6a98205f0 (Using Region): Document use-empty-active-region.
Chong Yidong <cyd@stupidchicken.com>
parents: 98678
diff changeset
232 region is active (@pxref{Spelling}). Normally, such commands use
02d6a98205f0 (Using Region): Document use-empty-active-region.
Chong Yidong <cyd@stupidchicken.com>
parents: 98678
diff changeset
233 their default behavior if the region is empty (i.e., if mark and point
02d6a98205f0 (Using Region): Document use-empty-active-region.
Chong Yidong <cyd@stupidchicken.com>
parents: 98678
diff changeset
234 are at the same position). If you want them to operate on the empty
02d6a98205f0 (Using Region): Document use-empty-active-region.
Chong Yidong <cyd@stupidchicken.com>
parents: 98678
diff changeset
235 region, change the variable @code{use-empty-active-region} to
02d6a98205f0 (Using Region): Document use-empty-active-region.
Chong Yidong <cyd@stupidchicken.com>
parents: 98678
diff changeset
236 @code{t}.
02d6a98205f0 (Using Region): Document use-empty-active-region.
Chong Yidong <cyd@stupidchicken.com>
parents: 98678
diff changeset
237
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
238 @node Mark Ring
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
239 @section The Mark Ring
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
240
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
241 @cindex mark ring
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
242 Aside from delimiting the region, the mark is also useful for
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
243 remembering spots that you may want to go back to. Each buffer
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
244 remembers 16 previous locations of the mark, in the @dfn{mark ring}.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
245 Commands that set the mark also push the old mark onto this ring.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
246
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
247 @table @kbd
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
248 @item C-@key{SPC} C-@key{SPC}
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
249 Set the mark, pushing it onto the mark ring, without activating it.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
250 @item C-u C-@key{SPC}
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
251 Move point to where the mark was, and restore the mark from the ring
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
252 of former marks.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
253 @end table
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
254
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
255 @kindex C-SPC C-SPC
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
256 The command C-@key{SPC} C-@key{SPC} is handy when you want to use
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
257 the mark to remember a position to which you may wish to return. It
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
258 pushes the current point onto the mark ring, without activating the
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
259 mark (which would cause Emacs to highlight the region). This is
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
260 actually two consecutive invocations of @kbd{C-@key{SPC}}
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
261 (@code{set-mark-command}); the first @kbd{C-@key{SPC}} sets the mark,
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
262 and the second @kbd{C-@key{SPC}} deactivates it. (When Transient Mark
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
263 mode is off, C-@key{SPC} C-@key{SPC} instead activates Transient Mark
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
264 mode temporarily. @xref{Persistent Mark}.)
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
265
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
266 @kindex C-u C-SPC
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
267 To return to a marked position, use @code{set-mark-command} with a
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
268 prefix argument: @kbd{C-u C-@key{SPC}}. This moves point to where the
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
269 mark was, and deactivates the mark if it was active. Each subsequent
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
270 @kbd{C-u C-@key{SPC}} jumps to a prior position stored in the mark
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
271 ring. The positions you move through in this way are not lost; they
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
272 go to the end of the ring.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
273
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
274 @vindex set-mark-command-repeat-pop
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
275 If you set @code{set-mark-command-repeat-pop} to non-@code{nil},
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
276 then immediately after you type @kbd{C-u C-@key{SPC}}, you can type
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
277 @kbd{C-@key{SPC}} instead of @kbd{C-u C-@key{SPC}} to cycle through
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
278 the mark ring. By default, @code{set-mark-command-repeat-pop} is
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
279 @code{nil}.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
280
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
281 Each buffer has its own mark ring. All editing commands use the
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
282 current buffer's mark ring. In particular, @kbd{C-u C-@key{SPC}}
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
283 always stays in the same buffer.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
284
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
285 @vindex mark-ring-max
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
286 The variable @code{mark-ring-max} specifies the maximum number of
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
287 entries to keep in the mark ring. If that many entries exist and
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
288 another one is pushed, the earliest one in the list is discarded. Repeating
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
289 @kbd{C-u C-@key{SPC}} cycles through the positions currently in the
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
290 ring.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
291
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
292 @vindex mark-even-if-inactive
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
293 If the variable @code{mark-even-if-inactive} is @code{nil}, commands
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
294 can only use the mark and the region when it is active. This variable
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
295 is non-@code{nil} by default.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
296
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
297 If you want to move back to the same place over and over, the mark
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
298 ring may not be convenient enough. If so, you can record the position
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
299 in a register for later retrieval (@pxref{RegPos,, Saving Positions in
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
300 Registers}).
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
301
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
302 @node Global Mark Ring
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
303 @section The Global Mark Ring
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
304 @cindex global mark ring
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
305
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
306 In addition to the ordinary mark ring that belongs to each buffer,
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
307 Emacs has a single @dfn{global mark ring}. Each time you set a mark,
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
308 in any buffer, this is recorded in the global mark ring in addition to
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
309 the current buffer's own mark ring.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
310
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
311 @kindex C-x C-@key{SPC}
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
312 @findex pop-global-mark
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
313 The command @kbd{C-x C-@key{SPC}} (@code{pop-global-mark}) jumps to
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
314 the buffer and position of the latest entry in the global ring. It also
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
315 rotates the ring, so that successive uses of @kbd{C-x C-@key{SPC}} take
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
316 you to earlier buffers and mark positions.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
317
98678
9c8e9543a90f (Shift Selection): Correct case in node name.
Chong Yidong <cyd@stupidchicken.com>
parents: 96338
diff changeset
318 @node Shift Selection
9c8e9543a90f (Shift Selection): Correct case in node name.
Chong Yidong <cyd@stupidchicken.com>
parents: 96338
diff changeset
319 @section Shift Selection
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
320 @cindex shift-selection
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
321
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
322 If you hold down the shift key while typing a cursor motion command,
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
323 this sets the mark before moving point, so that the region extends
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
324 from the original position of point to its new position. This
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
325 feature, newly introduced in Emacs 23, is referred to as
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
326 @dfn{shift-selection}. It is similar to the way text is selected in
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
327 other editors.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
328
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
329 The mark set via shift-selection behaves a little differently from
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
330 what we have described above. Firstly, in addition to the usual ways
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
331 of deactivating the mark (such as changing the buffer text or typing
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
332 @kbd{C-g}), the mark is deactivated by any @emph{unshifted} cursor
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
333 motion command. Secondly, any subsequent @emph{shifted} cursor motion
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
334 command avoids setting the mark anew. Therefore, a series of shifted
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
335 cursor motion commands will continuously extend the region.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
336
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
337 Shift-selection only works if the shifted cursor motion key is not
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
338 already bound to a separate command (@pxref{Customization}). For
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
339 example, if you bind @kbd{S-C-f} to another command, typing
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
340 @kbd{S-C-f} runs that command instead of performing a shift-selected
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
341 version of @kbd{C-f} (@code{forward-char}).
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
342
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
343 A mark set via mouse commands behaves the same as a mark set via
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
344 shift-selection (@pxref{Setting Mark}). For example, if you specify a
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
345 region by dragging the mouse, you can continue to extend the region
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
346 using shifted cursor motion commands. In either case, any unshifted
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
347 cursor motion command deactivates the mark.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
348
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
349 To turn off shift-selection, set @code{shift-select-mode} to
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
350 @code{nil}. Doing this does not disable setting the mark via mouse
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
351 commands.
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
352
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
353 @node Persistent Mark
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
354 @section Persistent Marks
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
355 @cindex mode, Transient Mark
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
356 @cindex Transient Mark mode
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
357 @cindex highlighting region
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
358 @cindex region highlighting
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
359 @cindex Zmacs mode
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
360
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
361 By default, the region is highlighted whenever it exists, and
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
362 disappears once you use it or explicitly deactivate the mark. This
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
363 behavior is called Transient Mark mode@footnote{It is also sometimes
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
364 called @dfn{Zmacs mode}, because the Zmacs editor on the MIT Lisp
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
365 Machine handled the mark in a similar way.}.
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
366
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
367 @findex transient-mark-mode
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
368 Turning off Transient Mark mode switches Emacs to an alternative
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
369 mode of operation, which was the default prior to Emacs 23. When
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
370 Transient Mark mode is off, the mark is persistent: it is @emph{never}
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
371 deactivated, but can be set to different locations using commands such
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
372 as @kbd{C-@key{SPC}}. After the first time you set the mark in a
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
373 buffer, there is always a region in that buffer. Emacs will not
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
374 highlight the region, because that would be a nuisance. As a special
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
375 exception, the region is temporarily highlighted after it is set with
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
376 the mouse.
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
377
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
378 To turn off Transient Mark mode, type @kbd{M-x transient-mark-mode}.
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
379 This command toggles the mode; you can use the same command to turn
96338
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
380 Transient Mark mode on again. You can also turn off Transient Mark
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
381 mode using the menu bar: in the @samp{Options} menu, toggle the
adedca23247f (Shift selection): New node.
Chong Yidong <cyd@stupidchicken.com>
parents: 93348
diff changeset
382 @samp{Active Region Highlighting} menu item.
93348
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
383
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
384 Here are the details of how Emacs behaves when Transient Mark mode
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
385 is off:
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
386
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
387 @itemize @bullet
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
388 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
389 Emacs does not show where the mark is located---you have to remember.
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
390 The usual solution to this problem is to set the mark and then use it
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
391 soon, before you forget where it is. Alternatively, you can check the
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
392 location of the mark by using @kbd{C-x C-x}, which exchanges the
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
393 positions of the point and the mark (@pxref{Setting Mark}).
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
394
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
395 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
396 Many commands that insert text, such as @kbd{C-y} (@code{yank}),
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
397 position point and the mark at opposite ends of the inserted text, so
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
398 that the region consists of the text just inserted. You can tell when
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
399 a command sets the mark because it displays @samp{Mark set} in the
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
400 echo area.
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
401
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
402 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
403 Many commands that move point long distances, like @kbd{M-<} and
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
404 @kbd{C-s}, first set the mark where point was.
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
405
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
406 @item
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
407 Some commands that ordinarily operate on the region, if one exists,
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
408 act instead on the entire buffer. For instance, @kbd{C-x u} normally
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
409 reverses changes within the region if one exists; when Transient Mark
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
410 mode is off, it acts on the entire buffer. However, you can type
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
411 @kbd{C-u C-x u} to make it operate on the region. @xref{Undo}. Other
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
412 commands that act this way are identified in their own documentation.
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
413 @end itemize
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
414
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
415 While Transient Mark mode is off, you can activate it temporarily
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
416 using @kbd{C-@key{SPC} C-@key{SPC}} or @kbd{C-u C-x C-x}.
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
417
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
418 @table @kbd
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
419 @item C-@key{SPC} C-@key{SPC}
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
420 @kindex C-@key{SPC} C-@key{SPC}
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
421 Set the mark at point (like plain @kbd{C-@key{SPC}}) and enable
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
422 Transient Mark mode just once, until the mark is deactivated. (This
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
423 is not really a separate command; you are using the @kbd{C-@key{SPC}}
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
424 command twice.)
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
425
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
426 @item C-u C-x C-x
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
427 @kindex C-u C-x C-x
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
428 Activate the mark without changing it; enable Transient Mark mode just
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
429 once, until the mark is deactivated. (This is the @kbd{C-x C-x}
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
430 command, @code{exchange-point-and-mark}, with a prefix argument.)
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
431 @end table
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
432
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
433 These commands set or activate the mark, and enable Transient Mark
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
434 mode only until the mark is deactivated. One reason you may want to
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
435 use them is that some commands operate on the entire buffer instead of
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
436 the region when Transient Mark mode is off. Enabling Transient Mark
1ca9eda2b6bc (Mark): Rearrange nodes.
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
437 mode momentarily gives you a way to use these commands on the region.
84255
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
438
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
439 @ignore
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
440 arch-tag: f35e4d82-911b-4cfc-a3d7-3c87b2abba20
6a497ce2a4a7 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
441 @end ignore