diff options
| author | Chong Yidong | 2011-10-12 13:38:34 -0400 |
|---|---|---|
| committer | Chong Yidong | 2011-10-12 13:38:34 -0400 |
| commit | e1a3f5b1c846da7e304db52d81d011c875cbdd8e (patch) | |
| tree | 5a32d2c9ba68d54fa17d1adbfbafd783cb28fa0e | |
| parent | 79beb1785aac3f8326f58710462e4b6be7f0449a (diff) | |
| download | emacs-e1a3f5b1c846da7e304db52d81d011c875cbdd8e.tar.gz emacs-e1a3f5b1c846da7e304db52d81d011c875cbdd8e.zip | |
Updates to Mark chapter in Emacs manual.
* mark.texi (Mark): Clarify description of disabled Transient Mark
mode.
(Setting Mark): Document prefix arg for C-x C-x. Document primary
selection changes. Mention that commands like C-y set the mark.
(Marking Objects): Add xref to Words node. Note that mark-word
and mark-sexp also have the "extend region" behavior.
(Using Region): Mention M-$ in the table. Document
mark-even-if-inactive here instead of in Mark Ring.
(Mark Ring): Move mark-even-if-inactive to Using Region. Take
note of the "Mark Set" behavior.
(Disabled Transient Mark): Rename from "Persistent Mark"
(Bug#9688). Callers changed.
* programs.texi (Expressions):
* text.texi (Words): Defer to Marking Objects for mark-word doc.
Fixes: debbugs:9689
| -rw-r--r-- | doc/emacs/ChangeLog | 18 | ||||
| -rw-r--r-- | doc/emacs/emacs.texi | 2 | ||||
| -rw-r--r-- | doc/emacs/fixit.texi | 13 | ||||
| -rw-r--r-- | doc/emacs/mark.texi | 291 | ||||
| -rw-r--r-- | doc/emacs/programs.texi | 14 | ||||
| -rw-r--r-- | doc/emacs/text.texi | 17 | ||||
| -rw-r--r-- | doc/emacs/trouble.texi | 8 |
7 files changed, 191 insertions, 172 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 6adbe95cc97..3089d2b3d5d 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,3 +1,21 @@ | |||
| 1 | 2011-10-12 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * mark.texi (Mark): Clarify description of disabled Transient Mark | ||
| 4 | mode (Bug#9689). | ||
| 5 | (Setting Mark): Document prefix arg for C-x C-x. Document primary | ||
| 6 | selection changes. Mention that commands like C-y set the mark. | ||
| 7 | (Marking Objects): Add xref to Words node. Note that mark-word | ||
| 8 | and mark-sexp also have the "extend region" behavior. | ||
| 9 | (Using Region): Mention M-$ in the table. Document | ||
| 10 | mark-even-if-inactive here instead of in Mark Ring. | ||
| 11 | (Mark Ring): Move mark-even-if-inactive to Using Region. Take | ||
| 12 | note of the "Mark Set" behavior. | ||
| 13 | (Disabled Transient Mark): Rename from "Persistent Mark" | ||
| 14 | (Bug#9688). Callers changed. | ||
| 15 | |||
| 16 | * programs.texi (Expressions): | ||
| 17 | * text.texi (Words): Defer to Marking Objects for mark-word doc. | ||
| 18 | |||
| 1 | 2011-10-09 Chong Yidong <cyd@stupidchicken.com> | 19 | 2011-10-09 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 20 | ||
| 3 | * help.texi (Help, Help Summary): Eliminate the unnecessary "help | 21 | * help.texi (Help, Help Summary): Eliminate the unnecessary "help |
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 286595c2b45..d34ecb01ad6 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi | |||
| @@ -306,7 +306,7 @@ The Mark and the Region | |||
| 306 | * Mark Ring:: Previous mark positions saved so you can go back there. | 306 | * Mark Ring:: Previous mark positions saved so you can go back there. |
| 307 | * Global Mark Ring:: Previous mark positions in various buffers. | 307 | * Global Mark Ring:: Previous mark positions in various buffers. |
| 308 | * Shift Selection:: Using shifted cursor motion keys. | 308 | * Shift Selection:: Using shifted cursor motion keys. |
| 309 | * Persistent Mark:: Keeping the mark active all the time. | 309 | * Disabled Transient Mark:: Leaving regions unhighlighted by default. |
| 310 | 310 | ||
| 311 | Killing and Moving Text | 311 | Killing and Moving Text |
| 312 | 312 | ||
diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi index c14041f2271..7a605100796 100644 --- a/doc/emacs/fixit.texi +++ b/doc/emacs/fixit.texi | |||
| @@ -98,11 +98,12 @@ was deliberate, redo the change as described above. | |||
| 98 | When there is an active region, any use of @code{undo} performs | 98 | When there is an active region, any use of @code{undo} performs |
| 99 | @dfn{selective undo}: it undoes the most recent change within the | 99 | @dfn{selective undo}: it undoes the most recent change within the |
| 100 | region, instead of the entire buffer. However, when Transient Mark | 100 | region, instead of the entire buffer. However, when Transient Mark |
| 101 | mode is off (@pxref{Persistent Mark}), @kbd{C-/} always operates on | 101 | mode is off (@pxref{Disabled Transient Mark}), @kbd{C-/} always |
| 102 | the entire buffer, ignoring the region. In this case, you can perform | 102 | operates on the entire buffer, ignoring the region. In this case, you |
| 103 | selective undo by supplying a prefix argument to the @code{undo} | 103 | can perform selective undo by supplying a prefix argument to the |
| 104 | command: @kbd{C-u C-/}. To undo further changes in the same region, | 104 | @code{undo} command: @kbd{C-u C-/}. To undo further changes in the |
| 105 | repeat the @code{undo} command (no prefix argument is needed). | 105 | same region, repeat the @code{undo} command (no prefix argument is |
| 106 | needed). | ||
| 106 | 107 | ||
| 107 | Some specialized buffers do not make undo records. Buffers whose | 108 | Some specialized buffers do not make undo records. Buffers whose |
| 108 | names start with spaces never do; these buffers are used internally by | 109 | names start with spaces never do; these buffers are used internally by |
| @@ -270,7 +271,7 @@ optionally correct it as well, type @kbd{M-$} (@code{ispell-word}). | |||
| 270 | If a region is active, @kbd{M-$} checks the spelling of all words | 271 | If a region is active, @kbd{M-$} checks the spelling of all words |
| 271 | within the region. @xref{Mark}. (When Transient Mark mode is off, | 272 | within the region. @xref{Mark}. (When Transient Mark mode is off, |
| 272 | @kbd{M-$} always acts on the word around or before point, ignoring the | 273 | @kbd{M-$} always acts on the word around or before point, ignoring the |
| 273 | region. @xref{Persistent Mark}.) | 274 | region; @pxref{Disabled Transient Mark}.) |
| 274 | 275 | ||
| 275 | @findex ispell | 276 | @findex ispell |
| 276 | @findex ispell-buffer | 277 | @findex ispell-buffer |
diff --git a/doc/emacs/mark.texi b/doc/emacs/mark.texi index 1a93f5b79c8..21d90a3fc79 100644 --- a/doc/emacs/mark.texi +++ b/doc/emacs/mark.texi | |||
| @@ -25,10 +25,9 @@ automatically @dfn{deactivates} the mark; this turns off the | |||
| 25 | highlighting. You can also explicitly deactivate the mark at any | 25 | highlighting. You can also explicitly deactivate the mark at any |
| 26 | time, by typing @kbd{C-g} (@pxref{Quitting}). | 26 | time, by typing @kbd{C-g} (@pxref{Quitting}). |
| 27 | 27 | ||
| 28 | This default behavior of the mark is known as Transient Mark mode. | 28 | This default behavior is known as Transient Mark mode. Disabling |
| 29 | Disabling Transient Mark mode switches Emacs to an alternative | 29 | Transient Mark mode switches Emacs to an alternative behavior, in |
| 30 | behavior, in which the mark is always active, which was the default | 30 | which the region is usually not highlighted. @xref{Disabled Transient Mark}. |
| 31 | prior to Emacs 23. @xref{Persistent Mark}. | ||
| 32 | 31 | ||
| 33 | @vindex highlight-nonselected-windows | 32 | @vindex highlight-nonselected-windows |
| 34 | Setting the mark in one buffer has no effect on the marks in other | 33 | Setting the mark in one buffer has no effect on the marks in other |
| @@ -41,13 +40,13 @@ if the variable @code{highlight-nonselected-windows} is | |||
| 41 | non-@code{nil}, each window highlights its own region. | 40 | non-@code{nil}, each window highlights its own region. |
| 42 | 41 | ||
| 43 | @menu | 42 | @menu |
| 44 | * Setting Mark:: Commands to set the mark. | 43 | * Setting Mark:: Commands to set the mark. |
| 45 | * Marking Objects:: Commands to put region around textual units. | 44 | * Marking Objects:: Commands to put region around textual units. |
| 46 | * 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. |
| 47 | * Mark Ring:: Previous mark positions saved so you can go back there. | 46 | * Mark Ring:: Previous mark positions saved so you can go back there. |
| 48 | * Global Mark Ring:: Previous mark positions in various buffers. | 47 | * Global Mark Ring:: Previous mark positions in various buffers. |
| 49 | * Shift Selection:: Using shifted cursor motion keys. | 48 | * Shift Selection:: Using shifted cursor motion keys. |
| 50 | * Persistent Mark:: Keeping the mark active all the time. | 49 | * Disabled Transient Mark:: Leaving regions unhighlighted by default. |
| 51 | @end menu | 50 | @end menu |
| 52 | 51 | ||
| 53 | @node Setting Mark | 52 | @node Setting Mark |
| @@ -61,8 +60,8 @@ Set the mark at point, and activate it (@code{set-mark-command}). | |||
| 61 | @item C-@@ | 60 | @item C-@@ |
| 62 | The same. | 61 | The same. |
| 63 | @item C-x C-x | 62 | @item C-x C-x |
| 64 | Set the mark at point, and move point where the mark was | 63 | Set the mark at point, and activate it; then move point where the mark |
| 65 | (@code{exchange-point-and-mark}). | 64 | used to be (@code{exchange-point-and-mark}). |
| 66 | @item Drag-Mouse-1 | 65 | @item Drag-Mouse-1 |
| 67 | Set point and the mark around the text you drag across. | 66 | Set point and the mark around the text you drag across. |
| 68 | @item Mouse-3 | 67 | @item Mouse-3 |
| @@ -87,52 +86,71 @@ and activates it. You can then move point away, leaving the mark | |||
| 87 | behind. | 86 | behind. |
| 88 | 87 | ||
| 89 | For example, suppose you wish to convert part of the buffer to upper | 88 | For example, suppose you wish to convert part of the buffer to upper |
| 90 | case. To accomplish this, go to the beginning of the desired text, | 89 | case. To accomplish this, go to one end of the desired text, type |
| 91 | type @kbd{C-@key{SPC}}, and move point until the desired portion of | 90 | @kbd{C-@key{SPC}}, and move point until the desired portion of text is |
| 92 | text is highlighted. Now type @kbd{C-x C-u} (@code{upcase-region}). | 91 | highlighted. Now type @kbd{C-x C-u} (@code{upcase-region}). This |
| 93 | This converts the text in the region to upper case, and then | 92 | converts the text in the region to upper case, and then deactivates |
| 94 | deactivates the mark. | 93 | the mark. |
| 94 | |||
| 95 | Whenever the mark is active, you can deactivate it by typing | ||
| 96 | @kbd{C-g} (@pxref{Quitting}). Most commands that operate on the | ||
| 97 | region also automatically deactivate the mark, like @kbd{C-x C-u} in | ||
| 98 | the above example. | ||
| 99 | |||
| 100 | Instead of setting the mark in order to operate on a region, you can | ||
| 101 | also use it to ``remember'' a position in the buffer (by typing | ||
| 102 | @kbd{C-@key{SPC} C-@key{SPC}}), and later jump back there (by typing | ||
| 103 | @kbd{C-u C-@key{SPC}}). @xref{Mark Ring}, for details. | ||
| 95 | 104 | ||
| 96 | @kindex C-x C-x | 105 | @kindex C-x C-x |
| 97 | @findex exchange-point-and-mark | 106 | @findex exchange-point-and-mark |
| 98 | The command @kbd{C-x C-x} (@code{exchange-point-and-mark}) exchanges | 107 | The command @kbd{C-x C-x} (@code{exchange-point-and-mark}) exchanges |
| 99 | the positions of point and the mark, keeping the region unchanged. If | 108 | the positions of point and the mark. @kbd{C-x C-x} is useful when you |
| 100 | the mark is inactive, Emacs first reactivates the mark wherever it was | 109 | are satisfied with the position of point but want to move the other |
| 101 | last set. @kbd{C-x C-x} is useful when you are satisfied with the | 110 | end of the region (where the mark is). Using @kbd{C-x C-x} a second |
| 102 | position of point but want to move the other end of the region (where | 111 | time, if necessary, puts the mark at the new position with point back |
| 103 | the mark is). Using @kbd{C-x C-x} a second time, if necessary, puts | 112 | at its original position. Normally, if the mark is inactive, this |
| 104 | the mark at the new position with point back at its original position. | 113 | command first reactivates the mark wherever it was last set, to ensure |
| 114 | that the region is left highlighted. However, if you call it with a | ||
| 115 | prefix argument, it leaves the mark inactive and the region | ||
| 116 | unhighlighted; you can use this to jump to the mark in a manner | ||
| 117 | similar to @kbd{C-u C-@key{SPC}}. | ||
| 105 | 118 | ||
| 106 | You can also set the mark with the mouse. If you press the left | 119 | You can also set the mark with the mouse. If you press the left |
| 107 | mouse button (@kbd{down-mouse-1}) and drag the mouse across a range of | 120 | mouse button (@kbd{down-mouse-1}) and drag the mouse across a range of |
| 108 | text while holding down this button, this sets the mark where you | 121 | text, this sets the mark where you first pressed the mouse button and |
| 109 | first pressed the mouse button and puts point where you release it. | 122 | puts point where you release it. Alternatively, clicking the right |
| 110 | Alternatively, clicking the right mouse button (@kbd{mouse-3}) sets | 123 | mouse button (@kbd{mouse-3}) sets the mark at point and then moves |
| 111 | the mark at point and then moves point to where you clicked. Using | 124 | point to where you clicked. @xref{Mouse Commands}, for a more |
| 112 | the mouse to mark a region also copies the region into the kill ring | 125 | detailed description of these mouse commands. |
| 113 | (@pxref{Kill Ring}). @xref{Mouse Commands}, for a more detailed | ||
| 114 | description of these mouse commands. | ||
| 115 | 126 | ||
| 116 | @cindex shift-selection | 127 | @cindex shift-selection |
| 117 | Finally, you can set the mark by holding down the shift key while | 128 | Finally, you can set the mark by holding down the shift key while |
| 118 | typing certain cursor motion commands (such as @kbd{S-@key{right}}, | 129 | typing certain cursor motion commands (such as @kbd{S-@key{right}}, |
| 119 | @kbd{S-C-f}, @kbd{S-C-n}, etc.) This is referred to as | 130 | @kbd{S-C-f}, @kbd{S-C-n}, etc.) This is called @dfn{shift-selection}. |
| 120 | @dfn{shift-selection}. This sets the mark at point before moving | 131 | It sets the mark at point before moving point, but only if there is no |
| 121 | point, but only if there is no active mark set via shift-selection. | 132 | active mark set via shift-selection. The mark set by mouse commands |
| 122 | The mark set by mouse commands and by shift-selection behaves slightly | 133 | and by shift-selection behaves slightly differently from the usual |
| 123 | differently from the usual mark: any subsequent unshifted cursor | 134 | mark: any subsequent unshifted cursor motion command deactivates it |
| 124 | motion command deactivates it automatically. For details, @xref{Shift | 135 | automatically. For details, @xref{Shift Selection}. |
| 125 | Selection}. | 136 | |
| 137 | Many commands that insert text, such as @kbd{C-y} (@code{yank}), set | ||
| 138 | the mark at the other end of the inserted text, without activating it. | ||
| 139 | This lets you easily return to that position (@pxref{Mark Ring}). You | ||
| 140 | can tell that a command does this when it shows @samp{Mark set} in the | ||
| 141 | echo area. | ||
| 126 | 142 | ||
| 127 | Whenever the mark is active, you can deactivate it by typing | 143 | @cindex primary selection |
| 128 | @kbd{C-g} (@pxref{Quitting}). The mark is also automatically | 144 | Under X, every time the region changes while the mark is active, |
| 129 | deactivated after certain non-motion commands. | 145 | Emacs saves the text in the region to the @dfn{primary selection}. |
| 146 | This lets you insert that text into other X applications with | ||
| 147 | @kbd{mouse-2} clicks. @xref{Primary Selection}. | ||
| 130 | 148 | ||
| 131 | @node Marking Objects | 149 | @node Marking Objects |
| 132 | @section Commands to Mark Textual Objects | 150 | @section Commands to Mark Textual Objects |
| 133 | 151 | ||
| 134 | @cindex marking sections of text | 152 | @cindex marking sections of text |
| 135 | Here are the commands for placing point and the mark around a textual | 153 | Here are commands for placing point and the mark around a textual |
| 136 | object such as a word, list, paragraph or page: | 154 | object such as a word, list, paragraph or page: |
| 137 | 155 | ||
| 138 | @table @kbd | 156 | @table @kbd |
| @@ -156,41 +174,41 @@ Move point to the beginning of the buffer, and set mark at the end | |||
| 156 | (@code{mark-whole-buffer}). | 174 | (@code{mark-whole-buffer}). |
| 157 | @end table | 175 | @end table |
| 158 | 176 | ||
| 177 | @kindex M-@@ | ||
| 159 | @findex mark-word | 178 | @findex mark-word |
| 179 | @kbd{M-@@} (@code{mark-word}) sets the mark at the end of the next | ||
| 180 | word (@pxref{Words}, for information about words). Repeated | ||
| 181 | invocations of this command extend the region by advancing the mark | ||
| 182 | one word at a time. As an exception, if the mark is active and | ||
| 183 | located before point, @kbd{M-@@} moves the mark backwards from its | ||
| 184 | current position one word at a time. | ||
| 185 | |||
| 186 | This command also accepts a numeric argument @var{n}, which tells it | ||
| 187 | to advance the mark by @var{n} words. A negative argument moves the | ||
| 188 | mark back by @var{n} words. | ||
| 189 | |||
| 190 | @kindex C-M-@@ | ||
| 160 | @findex mark-sexp | 191 | @findex mark-sexp |
| 161 | @kbd{M-@@} (@code{mark-word}) puts the mark at the end of the next | 192 | Similarly, @kbd{C-M-@@} (@code{mark-sexp}) puts the mark at the end |
| 162 | word, while @kbd{C-M-@@} (@code{mark-sexp}) puts it at the end of the | 193 | of the next balanced expression (@pxref{Expressions}). Repeated |
| 163 | next balanced expression (@pxref{Expressions}). These commands handle | 194 | invocations extend the region to subsequent expressions, while |
| 164 | arguments just like @kbd{M-f} and @kbd{C-M-f}. | 195 | positive or negative numeric arguments move the mark forward or |
| 196 | backward by the specified number of expressions. | ||
| 165 | 197 | ||
| 166 | @kindex C-x h | ||
| 167 | @findex mark-whole-buffer | ||
| 168 | The other commands in the above list set both point and mark, so as | 198 | The other commands in the above list set both point and mark, so as |
| 169 | to delimit an object in the buffer. @kbd{M-h} (@code{mark-paragraph}) | 199 | to delimit an object in the buffer. @kbd{M-h} (@code{mark-paragraph}) |
| 170 | moves point to the beginning of the paragraph that surrounds or | 200 | marks paragraphs (@pxref{Paragraphs}), @kbd{C-M-h} (@code{mark-defun}) |
| 171 | follows point, and sets the mark at the end of that paragraph | 201 | marks top-level definitions (@pxref{Moving by Defuns}), and @kbd{C-x |
| 172 | (@pxref{Paragraphs}). As a special exception, repeated invocations of | 202 | C-p} (@code{mark-page}) marks pages (@pxref{Pages}). Repeated |
| 173 | @kbd{M-h} extend the region to subsequent paragraphs. This is | 203 | invocations again play the same role, extending the region to |
| 174 | convenient for indenting, case-converting, or killing entire | 204 | consecutive objects; similarly, numeric arguments specify how many |
| 175 | paragraphs. | 205 | objects to move the mark by. |
| 176 | 206 | ||
| 177 | The @kbd{M-h} command accepts prefix arguments. If the argument's | 207 | @kindex C-x h |
| 178 | value is positive, @kbd{M-h} marks that many paragraphs starting with | 208 | @findex mark-whole-buffer |
| 179 | the one surrounding point; therefore, @kbd{C-u M-h} is equivalent to | 209 | @cindex select all |
| 180 | @kbd{M-h M-h M-h M-h}. If the prefix argument is @minus{}@var{n}, | 210 | @kbd{C-x h} (@code{mark-whole-buffer}) sets up the entire buffer as |
| 181 | @kbd{M-h} marks @var{n} paragraphs running back from the one | 211 | the region, by putting point at the beginning and the mark at the end. |
| 182 | surrounding point; in this case, point moves forward to the end of | ||
| 183 | that paragraph, and the mark goes at the start of the region. | ||
| 184 | |||
| 185 | Similarly, @kbd{C-M-h} (@code{mark-defun}) sets mark and point | ||
| 186 | around major top-level definitions (@pxref{Moving by Defuns}), and | ||
| 187 | @kbd{C-x C-p} (@code{mark-page}) does the same for pages | ||
| 188 | (@pxref{Pages}). These treat repeated invocations and prefix | ||
| 189 | arguments similarly to @code{mark-paragraph}. | ||
| 190 | |||
| 191 | Finally, @kbd{C-x h} (@code{mark-whole-buffer}) sets up the entire | ||
| 192 | buffer as the region, by putting point at the beginning and the mark | ||
| 193 | at the end. (In some programs this is called ``select all.'') | ||
| 194 | 212 | ||
| 195 | @node Using Region | 213 | @node Using Region |
| 196 | @section Operating on the Region | 214 | @section Operating on the Region |
| @@ -215,7 +233,7 @@ Indent it with @kbd{C-x @key{TAB}} or @kbd{C-M-\} (@pxref{Indentation}). | |||
| 215 | @item | 233 | @item |
| 216 | Fill it as text with @kbd{M-x fill-region} (@pxref{Filling}). | 234 | Fill it as text with @kbd{M-x fill-region} (@pxref{Filling}). |
| 217 | @item | 235 | @item |
| 218 | Print hardcopy with @kbd{M-x print-region} (@pxref{Printing}). | 236 | Check the spelling of words within it with @kbd{M-$} (@pxref{Spelling}). |
| 219 | @item | 237 | @item |
| 220 | Evaluate it as Lisp code with @kbd{M-x eval-region} (@pxref{Lisp Eval}). | 238 | Evaluate it as Lisp code with @kbd{M-x eval-region} (@pxref{Lisp Eval}). |
| 221 | @item | 239 | @item |
| @@ -224,9 +242,6 @@ Save it in a register with @kbd{C-x r s} (@pxref{Registers}). | |||
| 224 | Save it in a buffer or a file (@pxref{Accumulating Text}). | 242 | Save it in a buffer or a file (@pxref{Accumulating Text}). |
| 225 | @end itemize | 243 | @end itemize |
| 226 | 244 | ||
| 227 | Most commands that operate on the text in the region have the word | ||
| 228 | @code{region} in their names. | ||
| 229 | |||
| 230 | Some commands have a default behavior when the mark is inactive, but | 245 | Some commands have a default behavior when the mark is inactive, but |
| 231 | operate on the text in the region if the mark is active. For example, | 246 | operate on the text in the region if the mark is active. For example, |
| 232 | @kbd{M-$} (@code{ispell-word}) normally checks the spelling of the | 247 | @kbd{M-$} (@code{ispell-word}) normally checks the spelling of the |
| @@ -236,27 +251,35 @@ behavior if the region is empty (i.e., if mark and point are at the | |||
| 236 | same position). If you want them to operate on the empty region, | 251 | same position). If you want them to operate on the empty region, |
| 237 | change the variable @code{use-empty-active-region} to @code{t}. | 252 | change the variable @code{use-empty-active-region} to @code{t}. |
| 238 | 253 | ||
| 254 | @vindex mark-even-if-inactive | ||
| 255 | Other commands always operate on the text in the region, and have no | ||
| 256 | default behavior. Such commands usually have the word @code{region} | ||
| 257 | in their names, like @kbd{C-w} (@code{kill-region}) and @code{C-x C-u} | ||
| 258 | (@code{upcase-region}). If the mark is inactive, they operate on the | ||
| 259 | ``inactive region''---that is, on the text between point and the | ||
| 260 | position at which the mark was last set (@pxref{Mark Ring}). To | ||
| 261 | disable this behavior, change the variable | ||
| 262 | @code{mark-even-if-inactive} to @code{nil}. Then these commands will | ||
| 263 | instead signal an error if the mark is inactive. | ||
| 264 | |||
| 239 | @cindex Delete Selection mode | 265 | @cindex Delete Selection mode |
| 240 | @cindex mode, Delete Selection | 266 | @cindex mode, Delete Selection |
| 241 | @findex delete-selection-mode | 267 | @findex delete-selection-mode |
| 242 | If you enable Delete Selection mode, a minor mode, then inserting | 268 | By default, text insertion occurs normally even if the mark is |
| 243 | text while the mark is active causes the selected text to be deleted | 269 | active---for example, typing @kbd{a} inserts the character @samp{a}, |
| 244 | first. This also deactivates the mark. Many graphical applications | 270 | then deactivates the mark. If you enable Delete Selection mode, a |
| 245 | follow this convention, but Emacs does not. To toggle Delete | 271 | minor mode, then inserting text while the mark is active causes the |
| 246 | Selection mode on or off, type @kbd{M-x delete-selection-mode}. | 272 | text in the region to be deleted first. To toggle Delete Selection |
| 247 | Another effect of this mode is that some keys, such as @key{DEL} and | 273 | mode on or off, type @kbd{M-x delete-selection-mode}. |
| 248 | @kbd{C-d}, always kill the region if one exists. | ||
| 249 | 274 | ||
| 250 | @node Mark Ring | 275 | @node Mark Ring |
| 251 | @section The Mark Ring | 276 | @section The Mark Ring |
| 252 | 277 | ||
| 253 | @cindex mark ring | 278 | @cindex mark ring |
| 254 | Aside from delimiting the region, the mark is also useful for | 279 | Each buffer remembers previous locations of the mark, in the |
| 255 | remembering spots that you may want to go back to. Each buffer | 280 | @dfn{mark ring}. Commands that set the mark also push the old mark |
| 256 | remembers @code{mark-ring-max} previous locations of the mark, in the | 281 | onto this ring. One of the uses of the mark ring is to remember spots |
| 257 | @dfn{mark ring}. This defaults to 16 locations. | 282 | that you may want to go back to. |
| 258 | |||
| 259 | Commands that set the mark also push the old mark onto this ring. | ||
| 260 | 283 | ||
| 261 | @table @kbd | 284 | @table @kbd |
| 262 | @item C-@key{SPC} C-@key{SPC} | 285 | @item C-@key{SPC} C-@key{SPC} |
| @@ -267,15 +290,15 @@ of former marks. | |||
| 267 | @end table | 290 | @end table |
| 268 | 291 | ||
| 269 | @kindex C-SPC C-SPC | 292 | @kindex C-SPC C-SPC |
| 270 | The command C-@key{SPC} C-@key{SPC} is handy when you want to use | 293 | The command @kbd{C-@key{SPC} C-@key{SPC}} is handy when you want to |
| 271 | the mark to remember a position to which you may wish to return. It | 294 | use the mark to remember a position to which you may wish to return. |
| 272 | pushes the current point onto the mark ring, without activating the | 295 | It pushes the current point onto the mark ring, without activating the |
| 273 | mark (which would cause Emacs to highlight the region). This is | 296 | mark (which would cause Emacs to highlight the region). This is |
| 274 | actually two consecutive invocations of @kbd{C-@key{SPC}} | 297 | actually two consecutive invocations of @kbd{C-@key{SPC}} |
| 275 | (@code{set-mark-command}); the first @kbd{C-@key{SPC}} sets the mark, | 298 | (@code{set-mark-command}); the first @kbd{C-@key{SPC}} sets the mark, |
| 276 | and the second @kbd{C-@key{SPC}} deactivates it. (When Transient Mark | 299 | and the second @kbd{C-@key{SPC}} deactivates it. (When Transient Mark |
| 277 | mode is off, C-@key{SPC} C-@key{SPC} instead activates Transient Mark | 300 | mode is off, @kbd{C-@key{SPC} C-@key{SPC}} instead activates Transient |
| 278 | mode temporarily. @xref{Persistent Mark}.) | 301 | Mark mode temporarily; @pxref{Disabled Transient Mark}.) |
| 279 | 302 | ||
| 280 | @kindex C-u C-SPC | 303 | @kindex C-u C-SPC |
| 281 | To return to a marked position, use @code{set-mark-command} with a | 304 | To return to a marked position, use @code{set-mark-command} with a |
| @@ -298,15 +321,10 @@ always stays in the same buffer. | |||
| 298 | 321 | ||
| 299 | @vindex mark-ring-max | 322 | @vindex mark-ring-max |
| 300 | The variable @code{mark-ring-max} specifies the maximum number of | 323 | The variable @code{mark-ring-max} specifies the maximum number of |
| 301 | entries to keep in the mark ring. If that many entries exist and | 324 | entries to keep in the mark ring. This defaults to 16 entries. If |
| 302 | another one is pushed, the earliest one in the list is discarded. Repeating | 325 | that many entries exist and another one is pushed, the earliest one in |
| 303 | @kbd{C-u C-@key{SPC}} cycles through the positions currently in the | 326 | the list is discarded. Repeating @kbd{C-u C-@key{SPC}} cycles through |
| 304 | ring. | 327 | the positions currently in the ring. |
| 305 | |||
| 306 | @vindex mark-even-if-inactive | ||
| 307 | If the variable @code{mark-even-if-inactive} is @code{nil}, commands | ||
| 308 | can only use the mark and the region when it is active. This variable | ||
| 309 | is non-@code{nil} by default. | ||
| 310 | 328 | ||
| 311 | If you want to move back to the same place over and over, the mark | 329 | If you want to move back to the same place over and over, the mark |
| 312 | ring may not be convenient enough. If so, you can record the position | 330 | ring may not be convenient enough. If so, you can record the position |
| @@ -337,10 +355,9 @@ you to earlier buffers and mark positions. | |||
| 337 | 355 | ||
| 338 | If you hold down the shift key while typing a cursor motion command, | 356 | If you hold down the shift key while typing a cursor motion command, |
| 339 | this sets the mark before moving point, so that the region extends | 357 | this sets the mark before moving point, so that the region extends |
| 340 | from the original position of point to its new position. This | 358 | from the original position of point to its new position. This feature |
| 341 | feature, newly introduced in Emacs 23, is referred to as | 359 | is referred to as @dfn{shift-selection}. It is similar to the way |
| 342 | @dfn{shift-selection}. It is similar to the way text is selected in | 360 | text is selected in other editors. |
| 343 | other editors. | ||
| 344 | 361 | ||
| 345 | The mark set via shift-selection behaves a little differently from | 362 | The mark set via shift-selection behaves a little differently from |
| 346 | what we have described above. Firstly, in addition to the usual ways | 363 | what we have described above. Firstly, in addition to the usual ways |
| @@ -348,7 +365,7 @@ of deactivating the mark (such as changing the buffer text or typing | |||
| 348 | @kbd{C-g}), the mark is deactivated by any @emph{unshifted} cursor | 365 | @kbd{C-g}), the mark is deactivated by any @emph{unshifted} cursor |
| 349 | motion command. Secondly, any subsequent @emph{shifted} cursor motion | 366 | motion command. Secondly, any subsequent @emph{shifted} cursor motion |
| 350 | command avoids setting the mark anew. Therefore, a series of shifted | 367 | command avoids setting the mark anew. Therefore, a series of shifted |
| 351 | cursor motion commands will continuously extend the region. | 368 | cursor motion commands will continuously adjust the region. |
| 352 | 369 | ||
| 353 | Shift-selection only works if the shifted cursor motion key is not | 370 | Shift-selection only works if the shifted cursor motion key is not |
| 354 | already bound to a separate command (@pxref{Customization}). For | 371 | already bound to a separate command (@pxref{Customization}). For |
| @@ -363,57 +380,35 @@ using shifted cursor motion commands. In either case, any unshifted | |||
| 363 | cursor motion command deactivates the mark. | 380 | cursor motion command deactivates the mark. |
| 364 | 381 | ||
| 365 | To turn off shift-selection, set @code{shift-select-mode} to | 382 | To turn off shift-selection, set @code{shift-select-mode} to |
| 366 | @code{nil}. Doing this does not disable setting the mark via mouse | 383 | @code{nil}. Doing so does not disable setting the mark via mouse |
| 367 | commands. | 384 | commands. |
| 368 | 385 | ||
| 369 | @node Persistent Mark | 386 | @node Disabled Transient Mark |
| 370 | @section Persistent Marks | 387 | @section Disabling Transient Mark Mode |
| 371 | @cindex mode, Transient Mark | 388 | @cindex mode, Transient Mark |
| 372 | @cindex Transient Mark mode | 389 | @cindex Transient Mark mode |
| 373 | @cindex highlighting region | 390 | @cindex highlighting region |
| 374 | @cindex region highlighting | 391 | @cindex region highlighting |
| 375 | @cindex Zmacs mode | 392 | @cindex Zmacs mode |
| 376 | |||
| 377 | By default, the mark is activated by setting it, and deactivated by | ||
| 378 | most non-motion commands (including all commands that change the text | ||
| 379 | in the buffer). This behavior is called Transient Mark | ||
| 380 | mode@footnote{It is also sometimes called @dfn{Zmacs mode}, because | ||
| 381 | the Zmacs editor on the MIT Lisp Machine handled the mark in a similar | ||
| 382 | way.}. | ||
| 383 | |||
| 384 | Turning off Transient Mark mode switches Emacs to an alternative | ||
| 385 | mode of operation, which was the default prior to Emacs 23. When | ||
| 386 | Transient Mark mode is off, the mark is @emph{never} deactivated, but | ||
| 387 | it can be set to different locations using commands such as | ||
| 388 | @kbd{C-@key{SPC}}. Emacs does not highlight the region, because that | ||
| 389 | would be a nuisance. As a special exception, the region is | ||
| 390 | temporarily highlighted if you set it with the mouse (@pxref{Setting | ||
| 391 | Mark}), or with shift-selection (@pxref{Shift Selection}). | ||
| 392 | |||
| 393 | @findex transient-mark-mode | 393 | @findex transient-mark-mode |
| 394 | To turn off Transient Mark mode, type @kbd{M-x transient-mark-mode}. | ||
| 395 | This command toggles the mode; you can use the same command to turn it | ||
| 396 | on again. You can also toggle Transient Mark mode using the | ||
| 397 | @samp{Active Region Highlighting} menu item in the @samp{Options} | ||
| 398 | menu. | ||
| 399 | 394 | ||
| 400 | Here are the details of how Emacs behaves when Transient Mark mode | 395 | The default behavior of the mark and region, in which setting the |
| 401 | is off: | 396 | mark activates it and highlights the region, is called Transient Mark |
| 397 | mode. This is a minor mode that is enabled by default. It can be | ||
| 398 | toggled with @kbd{M-x transient-mark-mode}, or with the @samp{Active | ||
| 399 | Region Highlighting} menu item in the @samp{Options} menu. Turning it | ||
| 400 | off switches Emacs to an alternative mode of operation: | ||
| 402 | 401 | ||
| 403 | @itemize @bullet | 402 | @itemize @bullet |
| 404 | @item | 403 | @item |
| 405 | Emacs does not show where the mark is located---you have to remember. | 404 | Setting the mark, with commands like @kbd{C-@key{SPC}} or @kbd{C-x |
| 406 | The usual solution to this problem is to set the mark and then use it | 405 | C-x}, does not highlight the region. Therefore, you can't tell by |
| 407 | soon, before you forget where it is. Alternatively, you can check the | 406 | looking where the mark is located; you have to remember. |
| 408 | location of the mark by using @kbd{C-x C-x}, which exchanges the | ||
| 409 | positions of the point and the mark (@pxref{Setting Mark}). | ||
| 410 | 407 | ||
| 411 | @item | 408 | The usual solution to this problem is to set the mark and then use it |
| 412 | Many commands that insert text, such as @kbd{C-y} (@code{yank}), | 409 | soon, before you forget where it is. You can also check where the |
| 413 | position point and the mark at opposite ends of the inserted text, so | 410 | mark is by using @kbd{C-x C-x}, which exchanges the positions of the |
| 414 | that the region consists of the text just inserted. You can tell when | 411 | point and the mark (@pxref{Setting Mark}). |
| 415 | a command sets the mark because it displays @samp{Mark set} in the | ||
| 416 | echo area. | ||
| 417 | 412 | ||
| 418 | @item | 413 | @item |
| 419 | Many commands that move point long distances, like @kbd{M-<} and | 414 | Many commands that move point long distances, like @kbd{M-<} and |
| @@ -451,3 +446,7 @@ mode only until the mark is deactivated. One reason you may want to | |||
| 451 | use them is that some commands operate on the entire buffer instead of | 446 | use them is that some commands operate on the entire buffer instead of |
| 452 | the region when Transient Mark mode is off. Enabling Transient Mark | 447 | the region when Transient Mark mode is off. Enabling Transient Mark |
| 453 | mode momentarily gives you a way to use these commands on the region. | 448 | mode momentarily gives you a way to use these commands on the region. |
| 449 | |||
| 450 | When you specify a region with the mouse (@pxref{Setting Mark}), or | ||
| 451 | with shift-selection (@pxref{Shift Selection}), this likewise | ||
| 452 | activates Transient Mark mode temporarily and highlights the region. | ||
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 870986d421a..5745dd7c66c 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi | |||
| @@ -462,8 +462,9 @@ etc. To correct the overall indentation as well, type @key{TAB} | |||
| 462 | first. | 462 | first. |
| 463 | 463 | ||
| 464 | @kbd{C-M-\} (@code{indent-region}) applies @key{TAB} to the region. | 464 | @kbd{C-M-\} (@code{indent-region}) applies @key{TAB} to the region. |
| 465 | This is useful when Transient Mark mode is disabled (@pxref{Persistent | 465 | This is useful when Transient Mark mode is disabled (@pxref{Disabled |
| 466 | Mark}), because in that case @key{TAB} does not act on the region. | 466 | Transient Mark}), because in that case @key{TAB} does not act on the |
| 467 | region. | ||
| 467 | 468 | ||
| 468 | @kindex C-u TAB | 469 | @kindex C-u TAB |
| 469 | If you like the relative indentation within a grouping but not the | 470 | If you like the relative indentation within a grouping but not the |
| @@ -741,9 +742,12 @@ after point and the mark. | |||
| 741 | @kindex C-M-@@ | 742 | @kindex C-M-@@ |
| 742 | @kindex C-M-@key{SPC} | 743 | @kindex C-M-@key{SPC} |
| 743 | @findex mark-sexp | 744 | @findex mark-sexp |
| 744 | To set the region around the next balanced expression in the buffer, | 745 | To operate on balanced expressions with an operation which acts on |
| 745 | use @kbd{C-M-@key{SPC}} (@code{mark-sexp}), which sets mark at the | 746 | the region, use the command @kbd{C-M-@key{SPC}} (@code{mark-sexp}). |
| 746 | same place that @kbd{C-M-f} would move to. @kbd{C-M-@key{SPC}} treats | 747 | This sets the mark at the same place that @kbd{C-M-f} would move to. |
| 748 | @xref{Marking Objects}, for more information about this command. | ||
| 749 | |||
| 750 | @kbd{C-M-@key{SPC}} treats | ||
| 747 | numeric arguments in the same way as @kbd{C-M-f}; in particular, a | 751 | numeric arguments in the same way as @kbd{C-M-f}; in particular, a |
| 748 | negative argument puts the mark at the beginning of the previous | 752 | negative argument puts the mark at the beginning of the previous |
| 749 | balanced expression. The alias @kbd{C-M-@@} is equivalent to | 753 | balanced expression. The alias @kbd{C-M-@@} is equivalent to |
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index 96ccaa2b3c4..562ce92d427 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi | |||
| @@ -147,13 +147,10 @@ more on transposition. | |||
| 147 | 147 | ||
| 148 | @kindex M-@@ | 148 | @kindex M-@@ |
| 149 | @findex mark-word | 149 | @findex mark-word |
| 150 | To operate on the next @var{n} words with an operation which acts on | 150 | To operate on words with an operation which acts on the region, use |
| 151 | the region, use the command @kbd{M-@@} (@code{mark-word}). This | 151 | the command @kbd{M-@@} (@code{mark-word}). This command sets the mark |
| 152 | command does not move point, but sets the mark where @kbd{M-f} would | 152 | where @kbd{M-f} would move to. @xref{Marking Objects}, for more |
| 153 | move to. Once the mark is active, each additional @kbd{M-@@} advances | 153 | information about this command. |
| 154 | the mark by one additional word. @kbd{M-@@} also accepts a numeric | ||
| 155 | argument that says how many words to scan for the place to put the | ||
| 156 | mark. | ||
| 157 | 154 | ||
| 158 | The word commands' understanding of word boundaries is controlled by | 155 | The word commands' understanding of word boundaries is controlled by |
| 159 | the syntax table. Any character can, for example, be declared to be a | 156 | the syntax table. Any character can, for example, be declared to be a |
| @@ -2108,9 +2105,9 @@ the current Emacs session. | |||
| 2108 | If the region is active, the command applies to the text in the | 2105 | If the region is active, the command applies to the text in the |
| 2109 | region; otherwise, it applies to any immediately following | 2106 | region; otherwise, it applies to any immediately following |
| 2110 | self-inserting input. When Transient Mark mode is off | 2107 | self-inserting input. When Transient Mark mode is off |
| 2111 | (@pxref{Persistent Mark}), it always applies to the region unless a | 2108 | (@pxref{Disabled Transient Mark}), it always applies to the region |
| 2112 | prefix argument is given, in which case it applies to the following | 2109 | unless a prefix argument is given, in which case it applies to the |
| 2113 | input. | 2110 | following input. |
| 2114 | 2111 | ||
| 2115 | Each of the two color submenus contains one additional item: | 2112 | Each of the two color submenus contains one additional item: |
| 2116 | @samp{Other}. You can use this item to specify a color that is not | 2113 | @samp{Other}. You can use this item to specify a color that is not |
diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index fd06dde5174..ec159af6f84 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi | |||
| @@ -53,10 +53,10 @@ a kill command that is taking a long time, either your text will | |||
| 53 | @emph{all} still be in the buffer, or it will @emph{all} be in the | 53 | @emph{all} still be in the buffer, or it will @emph{all} be in the |
| 54 | kill ring, or maybe both. If the region is active, @kbd{C-g} | 54 | kill ring, or maybe both. If the region is active, @kbd{C-g} |
| 55 | deactivates the mark, unless Transient Mark mode is off | 55 | deactivates the mark, unless Transient Mark mode is off |
| 56 | (@pxref{Persistent Mark}). If you are in the middle of an incremental | 56 | (@pxref{Disabled Transient Mark}). If you are in the middle of an |
| 57 | search, @kbd{C-g} does special things; it may take two successive | 57 | incremental search, @kbd{C-g} does special things; it may take two |
| 58 | @kbd{C-g} characters to get out of a search. @xref{Incremental | 58 | successive @kbd{C-g} characters to get out of a search. |
| 59 | Search}, for details. | 59 | @xref{Incremental Search}, for details. |
| 60 | 60 | ||
| 61 | On MS-DOS, the character @kbd{C-@key{BREAK}} serves as a quit character | 61 | On MS-DOS, the character @kbd{C-@key{BREAK}} serves as a quit character |
| 62 | like @kbd{C-g}. The reason is that it is not feasible, on MS-DOS, to | 62 | like @kbd{C-g}. The reason is that it is not feasible, on MS-DOS, to |