Mercurial > emacs
comparison man/mark.texi @ 46237:46b0c6f318b5
New node Momentary Mark.
Clarify text for Transient Mark mode.
C-u C-SPC repetition does not need the C-u.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 07 Jul 2002 23:26:53 +0000 |
parents | 898b4b31410f |
children | 23a1cea22d13 |
comparison
equal
deleted
inserted
replaced
46236:b3a9c5fdc73a | 46237:46b0c6f318b5 |
---|---|
39 | 39 |
40 @menu | 40 @menu |
41 * Setting Mark:: Commands to set the mark. | 41 * Setting Mark:: Commands to set the mark. |
42 * Transient Mark:: How to make Emacs highlight the region-- | 42 * Transient Mark:: How to make Emacs highlight the region-- |
43 when there is one. | 43 when there is one. |
44 * Momentary Mark:: Enabling Transient Mark mode momentarily. | |
44 * Using Region:: Summary of ways to operate on contents of the region. | 45 * Using Region:: Summary of ways to operate on contents of the region. |
45 * Marking Objects:: Commands to put region around textual units. | 46 * Marking Objects:: Commands to put region around textual units. |
46 * Mark Ring:: Previous mark positions saved so you can go back there. | 47 * Mark Ring:: Previous mark positions saved so you can go back there. |
47 * Global Mark Ring:: Previous mark positions in various buffers. | 48 * Global Mark Ring:: Previous mark positions in various buffers. |
48 @end menu | 49 @end menu |
98 you forget where it is. Alternatively, you can see where the mark is | 99 you forget where it is. Alternatively, you can see where the mark is |
99 with the command @kbd{C-x C-x} (@code{exchange-point-and-mark}) which | 100 with the command @kbd{C-x C-x} (@code{exchange-point-and-mark}) which |
100 puts the mark where point was and point where the mark was. The extent | 101 puts the mark where point was and point where the mark was. The extent |
101 of the region is unchanged, but the cursor and point are now at the | 102 of the region is unchanged, but the cursor and point are now at the |
102 previous position of the mark. In Transient Mark mode, this command | 103 previous position of the mark. In Transient Mark mode, this command |
103 reactivates the mark. | 104 also reactivates the mark. |
104 | 105 |
105 @kbd{C-x C-x} is also useful when you are satisfied with the position | 106 @kbd{C-x C-x} is also useful when you are satisfied with the position |
106 of point but want to move the other end of the region (where the mark | 107 of point but want to move the other end of the region (where the mark |
107 is); do @kbd{C-x C-x} to put point at that end of the region, and then | 108 is); do @kbd{C-x C-x} to put point at that end of the region, and then |
108 move it. Using @kbd{C-x C-x} a second time, if necessary, puts the mark at | 109 move it. Using @kbd{C-x C-x} a second time, if necessary, puts the mark at |
126 @cindex mode, Transient Mark | 127 @cindex mode, Transient Mark |
127 @cindex Transient Mark mode | 128 @cindex Transient Mark mode |
128 @cindex highlighting region | 129 @cindex highlighting region |
129 @cindex region highlighting | 130 @cindex region highlighting |
130 | 131 |
131 On a terminal that supports colors, Emacs can highlight the current | 132 On a terminal that supports colors, Emacs has the ability to |
132 region. But normally it does not. Why not? | 133 highlight the current region. But normally it does not. Why not? |
133 | 134 |
134 Highlighting the region whenever it exists would not be desirable in | 135 Once you have set the mark in a buffer, there is @emph{always} a |
135 Emacs, because once you have set a mark, there is @emph{always} a | 136 region in that buffer. This is because every command that sets the |
136 region (in that buffer). And highlighting the region all the time | 137 mark also activates it, and nothing ever deactivates it. Highlighting |
137 would be a nuisance. So normally Emacs highlights the region only | 138 the region all the time would be a nuisance. So normally Emacs |
138 immediately after you have selected one with the mouse. | 139 highlights the region only immediately after you have selected one |
139 | 140 with the mouse. |
140 You can turn on region highlighting by enabling Transient Mark mode. | 141 |
141 This is a more rigid mode of operation in which the region ``lasts'' | 142 If you want region highlighting, you can use Transient Mark mode. |
142 only temporarily, so you must set up a region for each command that uses | 143 This is a more rigid mode of operation in which the region always |
143 one. In Transient Mark mode, most of the time there is no region; | 144 ``lasts'' only until you use it; you explicitly must set up a region |
144 therefore, highlighting the region when it exists is useful and | 145 for each command that uses one. In Transient Mark mode, most of the |
145 not annoying. | 146 time there is no region; therefore, highlighting the region when it |
147 exists is useful and not annoying. When Transient Mark mode is | |
148 enabled, Emacs always highlights the region whenever there is a | |
149 region. | |
146 | 150 |
147 @findex transient-mark-mode | 151 @findex transient-mark-mode |
148 To enable Transient Mark mode, type @kbd{M-x transient-mark-mode}. | 152 To enable Transient Mark mode, type @kbd{M-x transient-mark-mode}. |
149 This command toggles the mode, so you can repeat the command to turn off | 153 This command toggles the mode; you can use the same command to turn |
150 the mode. | 154 the mode off again. |
151 | 155 |
152 Here are the details of Transient Mark mode: | 156 Here are the details of Transient Mark mode: |
153 | 157 |
154 @itemize @bullet | 158 @itemize @bullet |
155 @item | 159 @item |
163 keyboard commands whose purpose is to specify a region, including | 167 keyboard commands whose purpose is to specify a region, including |
164 @kbd{M-@@}, @kbd{C-M-@@}, @kbd{M-h}, @kbd{C-M-h}, @kbd{C-x C-p}, and | 168 @kbd{M-@@}, @kbd{C-M-@@}, @kbd{M-h}, @kbd{C-M-h}, @kbd{C-x C-p}, and |
165 @kbd{C-x h}. | 169 @kbd{C-x h}. |
166 | 170 |
167 @item | 171 @item |
172 You can tell that the mark is active because the region is highlighted. | |
173 | |
174 @item | |
168 When the mark is active, you can execute commands that operate on the | 175 When the mark is active, you can execute commands that operate on the |
169 region, such as killing, indenting, or writing to a file. | 176 region, such as killing, indenting, or writing to a file. |
170 | 177 |
171 @item | 178 @item |
172 Any change to the buffer, such as inserting or deleting a character, | 179 Any change to the buffer, such as inserting or deleting a character, |
173 deactivates the mark. This means any subsequent command that operates | 180 deactivates the mark. This means any subsequent command that operates |
174 on a region will get an error and refuse to operate. You can make the | 181 on a region will get an error and refuse to operate. You can make the |
175 region active again by typing @kbd{C-x C-x}. | 182 region active again by typing @kbd{C-x C-x}. |
176 | 183 |
177 @item | 184 @item |
185 Quitting with @kbd{C-g} deactivates the mark. | |
186 | |
187 @item | |
178 Commands like @kbd{M->} and @kbd{C-s}, that ``leave the mark behind'' in | 188 Commands like @kbd{M->} and @kbd{C-s}, that ``leave the mark behind'' in |
179 addition to some other primary purpose, do not activate the new mark. | 189 addition to some other primary purpose, do not activate the new mark. |
180 You can activate the new region by executing @kbd{C-x C-x} | 190 You can activate the new region by executing @kbd{C-x C-x} |
181 (@code{exchange-point-and-mark}). | 191 (@code{exchange-point-and-mark}). |
182 | 192 |
183 @item | 193 @item |
184 @kbd{C-s} when the mark is active does not alter the mark. | 194 @kbd{C-s} when the mark is active does not alter the mark. |
185 | 195 |
186 @item | 196 @item |
187 Quitting with @kbd{C-g} deactivates the mark. | 197 Some commands operate on the region if a region is active. For |
188 | 198 instance, @kbd{C-x u} in Transient Mark mode operates on the region, |
189 @item | 199 when there is a region. (Outside Transient Mark mode, you must type |
190 Some commands operate on the region whenever it is active. For | 200 @kbd{C-u C-x u} if you want it to operate on the region.) |
191 instance, @kbd{C-x u} in Transient Mark mode operates on the region | 201 @xref{Undo}. Other commands that act this way are identified in their |
192 when there is a region. Outside Transient Mark mode, you must type | 202 own documentation. |
193 @kbd{C-u C-x u} if you want it to operate on the region. | |
194 @xref{Undo}. Other commands that act this way are identified | |
195 in their own documentation. | |
196 @end itemize | 203 @end itemize |
197 | 204 |
198 The highlighting of the region uses the @code{region} face; you can | 205 The highlighting of the region uses the @code{region} face; you can |
199 customize the appearance of the highlighted region by changing this | 206 customize the appearance of the highlighted region by changing this |
200 face. @xref{Face Customization}. | 207 face. @xref{Face Customization}. |
206 window highlights its region (@pxref{Windows}). However, if the | 213 window highlights its region (@pxref{Windows}). However, if the |
207 variable @code{highlight-nonselected-windows} is non-@code{nil}, then | 214 variable @code{highlight-nonselected-windows} is non-@code{nil}, then |
208 each window highlights its own region (provided that Transient Mark mode | 215 each window highlights its own region (provided that Transient Mark mode |
209 is enabled and the mark in the window's buffer is active). | 216 is enabled and the mark in the window's buffer is active). |
210 | 217 |
211 When Transient Mark mode is not enabled, every command that sets the | |
212 mark also activates it, and nothing ever deactivates it. | |
213 | |
214 @vindex mark-even-if-inactive | 218 @vindex mark-even-if-inactive |
215 If the variable @code{mark-even-if-inactive} is non-@code{nil} in | 219 If the variable @code{mark-even-if-inactive} is non-@code{nil} in |
216 Transient Mark mode, then commands can use the mark and the region | 220 Transient Mark mode, then commands can use the mark and the region |
217 even when it is inactive. Region highlighting appears and disappears | 221 even when it is inactive. Region highlighting appears and disappears |
218 just as it normally does in Transient Mark mode, but the mark doesn't | 222 just as it normally does in Transient Mark mode, but the mark doesn't |
219 really go away when the highlighting disappears. | 223 really go away when the highlighting disappears, so you can still use |
224 region commands. | |
220 | 225 |
221 @cindex Zmacs mode | 226 @cindex Zmacs mode |
222 Transient Mark mode is also sometimes known as ``Zmacs mode'' | 227 Transient Mark mode is also sometimes known as ``Zmacs mode'' |
223 because the Zmacs editor on the MIT Lisp Machine handled the mark in a | 228 because the Zmacs editor on the MIT Lisp Machine handled the mark in a |
224 similar way. | 229 similar way. |
230 | |
231 @node Momentary Mark | |
232 @section Using Transient Mark Mode Momentarily | |
233 | |
234 If you don't like Transient Mark mode in general, you might still | |
235 want to use it once in a while. To do this, type @kbd{C-@key{SPC} | |
236 C-@key{SPC}} or @kbd{C-u C-x C-x}. These commands set or activate the | |
237 mark, and enable Transient Mark mode only until the mark is | |
238 deactivated. | |
239 | |
240 @table @kbd | |
241 @item C-@key{SPC} C-@key{SPC} | |
242 @kindex C-@key{SPC} C-@key{SPC} | |
243 Set the mark at point (like plain @kbd{C-@key{SPC}}), and enable | |
244 Transient Mark mode just once until the mark is deactivated. (This is | |
245 not really a separate command; you are using the @kbd{C-@key{SPC}} | |
246 command twice.) | |
247 | |
248 @item C-u C-x C-x | |
249 @kindex C-u C-x C-x | |
250 Activate the mark without changing it, enable Transient Mark mode just | |
251 once until the mark is deactivated. (This is the @kbd{C-x C-x} command, | |
252 @code{exchange-point-and-mark}, with a prefix argument.) | |
253 @end table | |
254 | |
255 One of the secondary features of Transient Mark mode is that certain | |
256 commands operate on the region when there is an active region. If you | |
257 don't use Transient Mark mode, the region once set never becomes | |
258 inactive, so there is no way these commands to make such a | |
259 distinction. Enabling Transient Mark mode momentarily gives you a way | |
260 to use these commands on the region. | |
261 | |
262 The other way momentarily use of Transient Mark mode is useful | |
263 is that it highlights the region for the time being. | |
225 | 264 |
226 @node Using Region | 265 @node Using Region |
227 @section Operating on the Region | 266 @section Operating on the Region |
228 | 267 |
229 @cindex operations on a marked region | 268 @cindex operations on a marked region |
327 mark, in the @dfn{mark ring}. Commands that set the mark also push the | 366 mark, in the @dfn{mark ring}. Commands that set the mark also push the |
328 old mark onto this ring. To return to a marked location, use @kbd{C-u | 367 old mark onto this ring. To return to a marked location, use @kbd{C-u |
329 C-@key{SPC}} (or @kbd{C-u C-@@}); this is the command | 368 C-@key{SPC}} (or @kbd{C-u C-@@}); this is the command |
330 @code{set-mark-command} given a numeric argument. It moves point to | 369 @code{set-mark-command} given a numeric argument. It moves point to |
331 where the mark was, and restores the mark from the ring of former | 370 where the mark was, and restores the mark from the ring of former |
332 marks. Thus, repeated use of this command moves point to all of the old | 371 marks. |
333 marks on the ring, one by one. The mark positions you move through in | 372 |
334 this way are not lost; they go to the end of the ring. | 373 If you repeat the character @kbd{C-@key{SPC}}, after typing @kbd{C-u |
374 C-@key{SPC}}, each repetition moves point to a previous mark position | |
375 from the ring. The mark positions you move through in this way are | |
376 not lost; they go to the end of the ring. | |
335 | 377 |
336 Each buffer has its own mark ring. All editing commands use the current | 378 Each buffer has its own mark ring. All editing commands use the current |
337 buffer's mark ring. In particular, @kbd{C-u C-@key{SPC}} always stays in | 379 buffer's mark ring. In particular, @kbd{C-u C-@key{SPC}} always stays in |
338 the same buffer. | 380 the same buffer. |
339 | 381 |