diff options
| author | Chong Yidong | 2008-08-16 14:38:58 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-08-16 14:38:58 +0000 |
| commit | 7e9bf7567422c80c665b41a709aef336851afb5a (patch) | |
| tree | ff016c43dfb991267fdf788e3e6ff799878c3a66 /doc | |
| parent | b12c348f131ac5675cc892a5d39e371886cfbd77 (diff) | |
| download | emacs-7e9bf7567422c80c665b41a709aef336851afb5a.tar.gz emacs-7e9bf7567422c80c665b41a709aef336851afb5a.zip | |
(Killing): Copyedit. Define read-only text.
(Deletion): DEL and C-d were already explained in Erasing; xref there.
(Killing by Lines): Copyedit.
(Other Kill Commands): Move M-w description here.
(Yanking): Move M-w to Other Kill Commands.
(Kill Ring): Also mention saving text in registers. Link to Text
Properties in elisp manual.
(Accumulating Text): Copyedit.
(CUA Bindings): Shift selection is now the default.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/killing.texi | 289 |
1 files changed, 127 insertions, 162 deletions
diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi index 99753aaccac..5feb4041593 100644 --- a/doc/emacs/killing.texi +++ b/doc/emacs/killing.texi | |||
| @@ -12,13 +12,11 @@ | |||
| 12 | 12 | ||
| 13 | @dfn{Killing} means erasing text and copying it into the @dfn{kill | 13 | @dfn{Killing} means erasing text and copying it into the @dfn{kill |
| 14 | ring}, from which you can bring it back into the buffer by | 14 | ring}, from which you can bring it back into the buffer by |
| 15 | @dfn{yanking} it. (Some systems use the terms ``cutting'' and | 15 | @dfn{yanking} it. (Some applications use the terms ``cutting'' and |
| 16 | ``pasting'' for these operations.) This is the most common way of | 16 | ``pasting'' for similar operations.) This is the most common way of |
| 17 | moving or copying text within Emacs. Killing and yanking is very safe | 17 | moving or copying text within Emacs. It is very versatile, because |
| 18 | because Emacs remembers several recent kills, not just the last one. | 18 | there are commands for killing many different types of syntactic |
| 19 | It is versatile, because the many commands for killing syntactic units | 19 | units. |
| 20 | can also be used for moving those units. But there are other ways of | ||
| 21 | copying text for special purposes. | ||
| 22 | 20 | ||
| 23 | @iftex | 21 | @iftex |
| 24 | @section Deletion and Killing | 22 | @section Deletion and Killing |
| @@ -28,33 +26,38 @@ copying text for special purposes. | |||
| 28 | @cindex cutting text | 26 | @cindex cutting text |
| 29 | @cindex deletion | 27 | @cindex deletion |
| 30 | Most commands which erase text from the buffer save it in the kill | 28 | Most commands which erase text from the buffer save it in the kill |
| 31 | ring. These commands are known as @dfn{kill} commands. The commands | 29 | ring. These are known as @dfn{kill} commands. The kill ring stores |
| 32 | that erase text but do not save it in the kill ring are known as | 30 | several recent kills, not just the last one, so killing is a very safe |
| 33 | @dfn{delete} commands. The @kbd{C-x u} (@code{undo}) command | 31 | operation: when you make a new kill, you don't have to worry much |
| 34 | (@pxref{Undo}) can undo both kill and delete commands; the importance | 32 | about losing text that you previously killed. |
| 35 | of the kill ring is that you can also yank the text in a different | 33 | |
| 36 | place or places. Emacs has only one kill ring for all buffers, so you | 34 | You can yank text from the kill ring into any position in a buffer, |
| 37 | can kill text in one buffer and yank it in another buffer. | 35 | including a position in a different buffer; the kill ring is shared by |
| 38 | 36 | all buffers. The @kbd{C-/} (@code{undo}) command can undo both kill | |
| 39 | The delete commands include @kbd{C-d} (@code{delete-char}) and | 37 | and delete commands (@pxref{Undo}); the importance of the kill ring is |
| 40 | @key{DEL} (@code{delete-backward-char}), which delete only one | 38 | that you can yank the text in a different place. |
| 41 | character at a time, and those commands that delete only spaces or | 39 | |
| 42 | newlines. Commands that can erase significant amounts of nontrivial | 40 | Commands that erase text but do not save it in the kill ring are |
| 43 | data generally do a kill operation instead. The commands' names and | 41 | known as @dfn{delete} commands. These include @kbd{C-d} |
| 44 | individual descriptions use the words @samp{kill} and @samp{delete} to | 42 | (@code{delete-char}) and @key{DEL} (@code{delete-backward-char}), |
| 45 | say which kind of operation they perform. | 43 | which delete only one character at a time, and those commands that |
| 44 | delete only spaces or newlines. Commands that can erase significant | ||
| 45 | amounts of nontrivial data generally do a kill operation instead. The | ||
| 46 | commands' names and individual descriptions use the words @samp{kill} | ||
| 47 | and @samp{delete} to say which kind of operation they perform. | ||
| 46 | 48 | ||
| 47 | @vindex kill-read-only-ok | 49 | @vindex kill-read-only-ok |
| 48 | @cindex read-only text, killing | 50 | @cindex read-only text, killing |
| 49 | You cannot kill read-only text, since such text does not allow any | 51 | Some specialized buffers contain @dfn{read-only text}, which cannot |
| 50 | kind of modification. But some users like to use the kill commands to | 52 | be modified and therefore cannot be killed. But some users like to |
| 51 | copy read-only text into the kill ring, without actually changing it. | 53 | use the kill commands to copy read-only text into the kill ring, |
| 52 | Therefore, the kill commands work specially in a read-only buffer: | 54 | without actually changing it. Therefore, the kill commands work |
| 53 | they move over text, and copy it to the kill ring, without actually | 55 | specially in a read-only buffer: they move over text, and copy it to |
| 54 | deleting it from the buffer. Normally, kill commands beep and display | 56 | the kill ring, without actually deleting it from the buffer. |
| 55 | an error message when this happens. But if you set the variable | 57 | Normally, kill commands beep and display an error message when this |
| 56 | @code{kill-read-only-ok} to a non-@code{nil} value, they just print a | 58 | happens. But if you set the variable @code{kill-read-only-ok} to a |
| 57 | message in the echo area to explain why the text has not been erased. | 59 | non-@code{nil} value, they just print a message in the echo area to |
| 60 | explain why the text has not been erased. | ||
| 58 | 61 | ||
| 59 | You can also use the mouse to kill and yank. @xref{Cut and Paste}. | 62 | You can also use the mouse to kill and yank. @xref{Cut and Paste}. |
| 60 | 63 | ||
| @@ -78,12 +81,10 @@ erase just one character or only whitespace. | |||
| 78 | 81 | ||
| 79 | @table @kbd | 82 | @table @kbd |
| 80 | @item C-d | 83 | @item C-d |
| 81 | @itemx @key{DELETE} | 84 | @itemx @key{Delete} |
| 82 | Delete next character (@code{delete-char}). If your keyboard has a | 85 | Delete next character (@code{delete-char}). |
| 83 | @key{DELETE} function key (usually located in the edit keypad), Emacs | ||
| 84 | binds it to @code{delete-char} as well. | ||
| 85 | @item @key{DEL} | 86 | @item @key{DEL} |
| 86 | @itemx @key{BS} | 87 | @itemx @key{Backspace} |
| 87 | Delete previous character (@code{delete-backward-char}). | 88 | Delete previous character (@code{delete-backward-char}). |
| 88 | @item M-\ | 89 | @item M-\ |
| 89 | Delete spaces and tabs around point (@code{delete-horizontal-space}). | 90 | Delete spaces and tabs around point (@code{delete-horizontal-space}). |
| @@ -97,55 +98,15 @@ Join two lines by deleting the intervening newline, along with any | |||
| 97 | indentation following it (@code{delete-indentation}). | 98 | indentation following it (@code{delete-indentation}). |
| 98 | @end table | 99 | @end table |
| 99 | 100 | ||
| 100 | @kindex DEL | 101 | We have already described the basic deletion commands @kbd{C-d} |
| 101 | @kindex C-d | 102 | (@code{delete-char}) and @key{DEL} (@code{delete-backward-char}). |
| 102 | The most basic delete commands are @kbd{C-d} (@code{delete-char}) and | 103 | @xref{Erasing}. |
| 103 | @key{DEL} (@code{delete-backward-char}). @kbd{C-d} deletes the | ||
| 104 | character after point, the one the cursor is ``on top of.'' This | ||
| 105 | doesn't move point. @key{DEL} deletes the character before the cursor, | ||
| 106 | and moves point back. You can delete newlines like any other characters | ||
| 107 | in the buffer; deleting a newline joins two lines. Actually, @kbd{C-d} | ||
| 108 | and @key{DEL} aren't always delete commands; when given arguments, they | ||
| 109 | kill instead, since they can erase more than one character this way. | ||
| 110 | |||
| 111 | @kindex BACKSPACE | ||
| 112 | @kindex BS | ||
| 113 | @kindex DELETE | ||
| 114 | Every keyboard has a large key which is a short distance above the | ||
| 115 | @key{RET} or @key{ENTER} key and is normally used for erasing what you | ||
| 116 | have typed. It may be labeled @key{DEL}, @key{BACKSPACE}, @key{BS}, | ||
| 117 | @key{DELETE}, or even with a left arrow. Regardless of the label on | ||
| 118 | the key, in Emacs it called @key{DEL}, and it should delete one | ||
| 119 | character backwards. | ||
| 120 | |||
| 121 | Many keyboards (including standard PC keyboards) have a | ||
| 122 | @key{BACKSPACE} key a short ways above @key{RET} or @key{ENTER}, and a | ||
| 123 | @key{DELETE} key elsewhere. In that case, the @key{BACKSPACE} key is | ||
| 124 | @key{DEL}, and the @key{DELETE} key is equivalent to @kbd{C-d}---or it | ||
| 125 | should be. | ||
| 126 | |||
| 127 | Why do we say ``or it should be''? When Emacs starts up using a | ||
| 128 | graphical display, it determines automatically which key or keys should be | ||
| 129 | equivalent to @key{DEL}. As a result, @key{BACKSPACE} and/or @key{DELETE} | ||
| 130 | keys normally do the right things. But in some unusual cases Emacs | ||
| 131 | gets the wrong information from the system. If these keys don't do | ||
| 132 | what they ought to do, you need to tell Emacs which key to use for | ||
| 133 | @key{DEL}. @xref{DEL Does Not Delete}, for how to do this. | ||
| 134 | |||
| 135 | @findex normal-erase-is-backspace-mode | ||
| 136 | On most text-only terminals, Emacs cannot tell which keys the | ||
| 137 | keyboard really has, so it follows a uniform plan which may or may not | ||
| 138 | fit your keyboard. The uniform plan is that the @acronym{ASCII} @key{DEL} | ||
| 139 | character deletes, and the @acronym{ASCII} @key{BS} (backspace) character asks | ||
| 140 | for help (it is the same as @kbd{C-h}). If this is not right for your | ||
| 141 | keyboard, such as if you find that the key which ought to delete backwards | ||
| 142 | enters Help instead, see @ref{DEL Does Not Delete}. | ||
| 143 | 104 | ||
| 144 | @kindex M-\ | 105 | @kindex M-\ |
| 145 | @findex delete-horizontal-space | 106 | @findex delete-horizontal-space |
| 146 | @kindex M-SPC | 107 | @kindex M-SPC |
| 147 | @findex just-one-space | 108 | @findex just-one-space |
| 148 | The other delete commands are those which delete only whitespace | 109 | The other delete commands are those that delete only whitespace |
| 149 | characters: spaces, tabs and newlines. @kbd{M-\} | 110 | characters: spaces, tabs and newlines. @kbd{M-\} |
| 150 | (@code{delete-horizontal-space}) deletes all the spaces and tab | 111 | (@code{delete-horizontal-space}) deletes all the spaces and tab |
| 151 | characters before and after point. With a prefix argument, this only | 112 | characters before and after point. With a prefix argument, this only |
| @@ -176,27 +137,28 @@ Kill an entire line at once (@code{kill-whole-line}) | |||
| 176 | 137 | ||
| 177 | @kindex C-k | 138 | @kindex C-k |
| 178 | @findex kill-line | 139 | @findex kill-line |
| 179 | The simplest kill command is @kbd{C-k}. If given at the beginning of | 140 | The simplest kill command is @kbd{C-k}. If given at the beginning |
| 180 | a line, it kills all the text on the line, leaving it blank. When used | 141 | of a line, it kills all the text on the line@footnote{Here, ``line'' |
| 181 | on a blank line, it kills the whole line including its newline. To kill | 142 | means a logical text line, not a screen line. @xref{Continuation |
| 182 | an entire non-blank line, go to the beginning and type @kbd{C-k} twice. | 143 | Lines}.}, leaving it blank. When used on a blank line, it kills the |
| 183 | 144 | whole line including its newline. | |
| 184 | More generally, @kbd{C-k} kills from point up to the end of the line, | 145 | |
| 185 | unless it is at the end of a line. In that case it kills the newline | 146 | More precisely, @kbd{C-k} kills from point up to the end of the |
| 186 | following point, thus merging the next line into the current one. | 147 | line, unless it is at the end of a line. In that case it kills the |
| 187 | Spaces and tabs that you can't see at the end of the line are ignored | 148 | newline following point, thus merging the next line into the current |
| 188 | when deciding which case applies, so if point appears to be at the end | 149 | one. Spaces and tabs at the end of the line are ignored when deciding |
| 189 | of the line, you can be sure @kbd{C-k} will kill the newline. | 150 | which case applies, so as long as point is after the last visible |
| 190 | 151 | character in the line, you can be sure that @kbd{C-k} will kill the | |
| 191 | When @kbd{C-k} is given a positive argument, it kills that many lines | 152 | newline. To kill an entire non-blank line, go to the beginning and |
| 192 | and the newlines that follow them (however, text on the current line | 153 | type @kbd{C-k} twice. |
| 193 | before point is not killed). With a negative argument @minus{}@var{n}, it | 154 | |
| 194 | kills @var{n} lines preceding the current line (together with the text | 155 | When @kbd{C-k} is given a positive argument @var{n}, it kills |
| 195 | on the current line before point). Thus, @kbd{C-u - 2 C-k} at the front | 156 | @var{n} lines and the newlines that follow them (text on the current |
| 196 | of a line kills the two previous lines. | 157 | line before point is not killed). With a negative argument |
| 197 | 158 | @minus{}@var{n}, it kills @var{n} lines preceding the current line, | |
| 198 | @kbd{C-k} with an argument of zero kills the text before point on the | 159 | together with the text on the current line before point. @kbd{C-k} |
| 199 | current line. | 160 | with an argument of zero kills the text before point on the current |
| 161 | line. | ||
| 200 | 162 | ||
| 201 | @vindex kill-whole-line | 163 | @vindex kill-whole-line |
| 202 | If the variable @code{kill-whole-line} is non-@code{nil}, @kbd{C-k} at | 164 | If the variable @code{kill-whole-line} is non-@code{nil}, @kbd{C-k} at |
| @@ -218,6 +180,9 @@ the key sequence @kbd{C-S-backspace}. | |||
| 218 | @table @kbd | 180 | @table @kbd |
| 219 | @item C-w | 181 | @item C-w |
| 220 | Kill region (@code{kill-region}). @xref{Mark}. | 182 | Kill region (@code{kill-region}). @xref{Mark}. |
| 183 | @item M-w | ||
| 184 | Save region as last killed text without actually killing it | ||
| 185 | (@code{kill-ring-save}). Some programs call this ``copying.'' | ||
| 221 | @item M-d | 186 | @item M-d |
| 222 | Kill word (@code{kill-word}). @xref{Words}. | 187 | Kill word (@code{kill-word}). @xref{Words}. |
| 223 | @item M-@key{DEL} | 188 | @item M-@key{DEL} |
| @@ -233,24 +198,32 @@ Kill the following balanced expression (@code{kill-sexp}). @xref{Expressions}. | |||
| 233 | Kill through the next occurrence of @var{char} (@code{zap-to-char}). | 198 | Kill through the next occurrence of @var{char} (@code{zap-to-char}). |
| 234 | @end table | 199 | @end table |
| 235 | 200 | ||
| 236 | The most general kill command is @kbd{C-w} (@code{kill-region}), | 201 | Apart from @kbd{C-k}, the most commonly-used kill command is |
| 237 | which kills everything between point and the mark. With this command, | 202 | @kbd{C-w} (@code{kill-region}), which kills the text in the region |
| 238 | you can kill any contiguous sequence of characters, if you first set | 203 | (i.e., between point and mark). @xref{Mark}. If the mark is inactive |
| 239 | the region around them. | 204 | when you type @kbd{C-w}, it first reactivates the mark where it was |
| 205 | last set. The mark is deactivated at the end of the command. | ||
| 206 | |||
| 207 | @kindex M-w | ||
| 208 | @findex kill-ring-save | ||
| 209 | The command @kbd{M-w} (@code{kill-ring-save}) copies the region into | ||
| 210 | the kill ring without removing it from the buffer. This is | ||
| 211 | approximately equivalent to @kbd{C-w} followed by @kbd{C-/}, except | ||
| 212 | that @kbd{M-w} does not alter the undo history. | ||
| 213 | |||
| 214 | Emacs also provides commands to kill specific syntactic units: | ||
| 215 | words, with @kbd{M-@key{DEL}} and @kbd{M-d} (@pxref{Words}); balanced | ||
| 216 | expressions, with @kbd{C-M-k} (@pxref{Expressions}); and sentences, | ||
| 217 | with @kbd{C-x @key{DEL}} and @kbd{M-k} (@pxref{Sentences}). | ||
| 240 | 218 | ||
| 241 | @kindex M-z | 219 | @kindex M-z |
| 242 | @findex zap-to-char | 220 | @findex zap-to-char |
| 243 | A convenient way of killing is combined with searching: @kbd{M-z} | 221 | The command @kbd{M-z} (@code{zap-to-char}) combines killing with |
| 244 | (@code{zap-to-char}) reads a character and kills from point up to (and | 222 | searching: it reads a character and kills from point up to (and |
| 245 | including) the next occurrence of that character in the buffer. A | 223 | including) the next occurrence of that character in the buffer. A |
| 246 | numeric argument acts as a repeat count. A negative argument means to | 224 | numeric argument acts as a repeat count; a negative argument means to |
| 247 | search backward and kill text before point. | 225 | search backward and kill text before point. |
| 248 | 226 | ||
| 249 | Other syntactic units can be killed: words, with @kbd{M-@key{DEL}} | ||
| 250 | and @kbd{M-d} (@pxref{Words}); balanced expressions, with @kbd{C-M-k} | ||
| 251 | (@pxref{Expressions}); and sentences, with @kbd{C-x @key{DEL}} and | ||
| 252 | @kbd{M-k} (@pxref{Sentences}).@refill | ||
| 253 | |||
| 254 | @node Yanking, Accumulating Text, Killing, Top | 227 | @node Yanking, Accumulating Text, Killing, Top |
| 255 | @section Yanking | 228 | @section Yanking |
| 256 | @cindex moving text | 229 | @cindex moving text |
| @@ -259,10 +232,9 @@ and @kbd{M-d} (@pxref{Words}); balanced expressions, with @kbd{C-M-k} | |||
| 259 | @cindex yanking | 232 | @cindex yanking |
| 260 | @cindex pasting | 233 | @cindex pasting |
| 261 | 234 | ||
| 262 | @dfn{Yanking} means reinserting text previously killed. This is what | 235 | @dfn{Yanking} means reinserting text previously killed. The usual |
| 263 | some systems call ``pasting.'' The usual way to move or copy text is to | 236 | way to move or copy text is to kill it and then yank it elsewhere one |
| 264 | kill it and then yank it elsewhere one or more times. This is very safe | 237 | or more times. |
| 265 | because Emacs remembers many recent kills, not just the last one. | ||
| 266 | 238 | ||
| 267 | @table @kbd | 239 | @table @kbd |
| 268 | @item C-y | 240 | @item C-y |
| @@ -270,9 +242,6 @@ Yank last killed text (@code{yank}). | |||
| 270 | @item M-y | 242 | @item M-y |
| 271 | Replace text just yanked with an earlier batch of killed text | 243 | Replace text just yanked with an earlier batch of killed text |
| 272 | (@code{yank-pop}). | 244 | (@code{yank-pop}). |
| 273 | @item M-w | ||
| 274 | Save region as last killed text without actually killing it | ||
| 275 | (@code{kill-ring-save}). Some systems call this ``copying.'' | ||
| 276 | @item C-M-w | 245 | @item C-M-w |
| 277 | Append next kill to last batch of killed text (@code{append-next-kill}). | 246 | Append next kill to last batch of killed text (@code{append-next-kill}). |
| 278 | @end table | 247 | @end table |
| @@ -291,11 +260,14 @@ instead of text killed within Emacs. | |||
| 291 | @node Kill Ring | 260 | @node Kill Ring |
| 292 | @subsection The Kill Ring | 261 | @subsection The Kill Ring |
| 293 | 262 | ||
| 294 | All killed text is recorded in the @dfn{kill ring}, a list of blocks of | 263 | All killed text is recorded in the @dfn{kill ring}, a list of blocks |
| 295 | text that have been killed. There is only one kill ring, shared by all | 264 | of text that have been killed. There is only one kill ring, shared by |
| 296 | buffers, so you can kill text in one buffer and yank it in another buffer. | 265 | all buffers, so you can kill text in one buffer and yank it in another |
| 297 | This is the usual way to move text from one file to another. | 266 | buffer. This is the usual way to move text from one file to another. |
| 298 | (@xref{Accumulating Text}, for some other ways.) | 267 | (There are several other methods: for instance, you could store the |
| 268 | text in a register. @xref{Registers}, for information about | ||
| 269 | registers. @xref{Accumulating Text}, for some other ways to move text | ||
| 270 | around.) | ||
| 299 | 271 | ||
| 300 | @kindex C-y | 272 | @kindex C-y |
| 301 | @findex yank | 273 | @findex yank |
| @@ -303,7 +275,7 @@ This is the usual way to move text from one file to another. | |||
| 303 | recent kill, leaving the cursor at the end of the text. It also adds | 275 | recent kill, leaving the cursor at the end of the text. It also adds |
| 304 | the position of the beginning of the text to the mark ring, without | 276 | the position of the beginning of the text to the mark ring, without |
| 305 | activating the mark; this allows you to jump easily to that position | 277 | activating the mark; this allows you to jump easily to that position |
| 306 | with @kbd{C-@key{SPC}} (@pxref{Mark Ring}). With a plain prefix | 278 | with @kbd{C-x C-x} (@pxref{Setting Mark}). With a plain prefix |
| 307 | argument (@kbd{C-u C-y}), it instead leaves the cursor in front of the | 279 | argument (@kbd{C-u C-y}), it instead leaves the cursor in front of the |
| 308 | text, and adds the position of the end of the text to the mark ring. | 280 | text, and adds the position of the end of the text to the mark ring. |
| 309 | Using other sort of prefix argument specifies an earlier kill; for | 281 | Using other sort of prefix argument specifies an earlier kill; for |
| @@ -312,20 +284,14 @@ example, @kbd{C-u 4 C-y} reinserts the fourth most recent kill. | |||
| 312 | 284 | ||
| 313 | @cindex yanking and text properties | 285 | @cindex yanking and text properties |
| 314 | @vindex yank-excluded-properties | 286 | @vindex yank-excluded-properties |
| 315 | The yank commands discard certain text properties from the text that | 287 | The yank commands discard certain properties from the yanked text. |
| 316 | is yanked, those that might lead to annoying results. For instance, | 288 | These are properties that might lead to annoying results, such as |
| 317 | they discard text properties that respond to the mouse or specify key | 289 | causing the text to respond to the mouse or specifying key bindings. |
| 318 | bindings. The variable @code{yank-excluded-properties} specifies the | 290 | The list of properties to discard is stored in the variable |
| 319 | properties to discard. Yanking of register contents and rectangles | 291 | @code{yank-excluded-properties}. Yanking of register contents and |
| 320 | also discard these properties. | 292 | rectangles also discard these properties. @xref{Text Properties,,, |
| 321 | 293 | elisp, the Emacs Lisp Reference Manual}, for more information about | |
| 322 | @kindex M-w | 294 | text properties. |
| 323 | @findex kill-ring-save | ||
| 324 | To copy a block of text, you can use @kbd{M-w} | ||
| 325 | (@code{kill-ring-save}), which copies the region into the kill ring | ||
| 326 | without removing it from the buffer. This is approximately equivalent | ||
| 327 | to @kbd{C-w} followed by @kbd{C-x u}, except that @kbd{M-w} does not | ||
| 328 | alter the undo history and does not temporarily change the screen. | ||
| 329 | 295 | ||
| 330 | @node Appending Kills | 296 | @node Appending Kills |
| 331 | @subsection Appending Kills | 297 | @subsection Appending Kills |
| @@ -379,8 +345,8 @@ it kills to the last killed text, instead of starting a new entry. With | |||
| 379 | @kbd{C-M-w}, you can kill several separated pieces of text and | 345 | @kbd{C-M-w}, you can kill several separated pieces of text and |
| 380 | accumulate them to be yanked back in one place.@refill | 346 | accumulate them to be yanked back in one place.@refill |
| 381 | 347 | ||
| 382 | A kill command following @kbd{M-w} does not append to the text that | 348 | A kill command following @kbd{M-w} (@code{kill-ring-save}) does not |
| 383 | @kbd{M-w} copied into the kill ring. | 349 | append to the text that @kbd{M-w} copied into the kill ring. |
| 384 | 350 | ||
| 385 | @node Earlier Kills | 351 | @node Earlier Kills |
| 386 | @subsection Yanking Earlier Kills | 352 | @subsection Yanking Earlier Kills |
| @@ -451,10 +417,9 @@ the command @kbd{C-h v kill-ring}. | |||
| 451 | @cindex accumulating scattered text | 417 | @cindex accumulating scattered text |
| 452 | Usually we copy or move text by killing it and yanking it, but there | 418 | Usually we copy or move text by killing it and yanking it, but there |
| 453 | are other convenient methods for copying one block of text in many | 419 | are other convenient methods for copying one block of text in many |
| 454 | places, or for copying many scattered blocks of text into one place. To | 420 | places, or for copying many scattered blocks of text into one place. |
| 455 | copy one block to many places, store it in a register | 421 | Here we describe the commands to accumulate scattered pieces of text |
| 456 | (@pxref{Registers}). Here we describe the commands to accumulate | 422 | into a buffer or into a file. |
| 457 | scattered pieces of text into a buffer or into a file. | ||
| 458 | 423 | ||
| 459 | @table @kbd | 424 | @table @kbd |
| 460 | @item M-x append-to-buffer | 425 | @item M-x append-to-buffer |
| @@ -500,28 +465,31 @@ inserted text. It also adds the position of the end of the inserted | |||
| 500 | text to the mark ring, without activating the mark. @xref{Buffers}, | 465 | text to the mark ring, without activating the mark. @xref{Buffers}, |
| 501 | for background information on buffers. | 466 | for background information on buffers. |
| 502 | 467 | ||
| 503 | Instead of accumulating text within Emacs, in a buffer, you can append | 468 | Instead of accumulating text in a buffer, you can append text |
| 504 | text directly into a file with @kbd{M-x append-to-file}, which takes | 469 | directly into a file with @kbd{M-x append-to-file}. This prompts for |
| 505 | @var{filename} as an argument. It adds the text of the region to the end | 470 | a filename, and adds the text of the region to the end of the |
| 506 | of the specified file. The file is changed immediately on disk. | 471 | specified file. The file is changed immediately on disk. |
| 507 | 472 | ||
| 508 | You should use @code{append-to-file} only with files that are | 473 | You should use @code{append-to-file} only with files that are |
| 509 | @emph{not} being visited in Emacs. Using it on a file that you are | 474 | @emph{not} being visited in Emacs. Using it on a file that you are |
| 510 | editing in Emacs would change the file behind Emacs's back, which | 475 | editing in Emacs would change the file behind Emacs's back, which |
| 511 | can lead to losing some of your editing. | 476 | can lead to losing some of your editing. |
| 512 | 477 | ||
| 478 | Another way to move text around is to store it in a register. | ||
| 479 | @xref{Registers}. | ||
| 480 | |||
| 513 | @node Rectangles, CUA Bindings, Accumulating Text, Top | 481 | @node Rectangles, CUA Bindings, Accumulating Text, Top |
| 514 | @section Rectangles | 482 | @section Rectangles |
| 515 | @cindex rectangle | 483 | @cindex rectangle |
| 516 | @cindex columns (and rectangles) | 484 | @cindex columns (and rectangles) |
| 517 | @cindex killing rectangular areas of text | 485 | @cindex killing rectangular areas of text |
| 518 | 486 | ||
| 519 | The rectangle commands operate on rectangular areas of the text: all | 487 | @dfn{Rectangle} commands operate on rectangular areas of the text: |
| 520 | the characters between a certain pair of columns, in a certain range of | 488 | all the characters between a certain pair of columns, in a certain |
| 521 | lines. Commands are provided to kill rectangles, yank killed rectangles, | 489 | range of lines. Emacs has commands to kill rectangles, yank killed |
| 522 | clear them out, fill them with blanks or text, or delete them. Rectangle | 490 | rectangles, clear them out, fill them with blanks or text, or delete |
| 523 | commands are useful with text in multicolumn formats, and for changing | 491 | them. Rectangle commands are useful with text in multicolumn formats, |
| 524 | text into or out of such formats. | 492 | and for changing text into or out of such formats. |
| 525 | 493 | ||
| 526 | @cindex mark rectangle | 494 | @cindex mark rectangle |
| 527 | When you must specify a rectangle for a command to work on, you do it | 495 | When you must specify a rectangle for a command to work on, you do it |
| @@ -651,17 +619,14 @@ effect when the mark is active (and the region is highlighted). | |||
| 651 | However, if you don't want to override these bindings in Emacs at all, | 619 | However, if you don't want to override these bindings in Emacs at all, |
| 652 | set @code{cua-enable-cua-keys} to @code{nil}. | 620 | set @code{cua-enable-cua-keys} to @code{nil}. |
| 653 | 621 | ||
| 654 | In CUA mode, using @kbd{Shift} together with the movement keys | ||
| 655 | activates and highlights the region over which they move. The | ||
| 656 | standard (unshifted) movement keys deactivate the mark, and typed text | ||
| 657 | replaces the active region as in Delete-Selection mode | ||
| 658 | (@pxref{Mouse Commands}). | ||
| 659 | |||
| 660 | To enter an Emacs command like @kbd{C-x C-f} while the mark is | 622 | To enter an Emacs command like @kbd{C-x C-f} while the mark is |
| 661 | active, use one of the following methods: either hold @kbd{Shift} | 623 | active, use one of the following methods: either hold @kbd{Shift} |
| 662 | together with the prefix key, e.g. @kbd{S-C-x C-f}, or quickly type | 624 | together with the prefix key, e.g. @kbd{S-C-x C-f}, or quickly type |
| 663 | the prefix key twice, e.g. @kbd{C-x C-x C-f}. | 625 | the prefix key twice, e.g. @kbd{C-x C-x C-f}. |
| 664 | 626 | ||
| 627 | In CUA mode, typed text replaces the active region as in | ||
| 628 | Delete-Selection mode (@pxref{Mouse Commands}). | ||
| 629 | |||
| 665 | @cindex rectangle highlighting | 630 | @cindex rectangle highlighting |
| 666 | CUA mode provides enhanced rectangle support with visible | 631 | CUA mode provides enhanced rectangle support with visible |
| 667 | rectangle highlighting. Use @kbd{C-RET} to start a rectangle, | 632 | rectangle highlighting. Use @kbd{C-RET} to start a rectangle, |