diff options
| author | Chong Yidong | 2011-07-10 23:38:49 -0400 |
|---|---|---|
| committer | Chong Yidong | 2011-07-10 23:38:49 -0400 |
| commit | 4d45a8b7a237e1d33d0ae71d95a0ed7165ea6cda (patch) | |
| tree | b193b0854adbfd7b4620ae1b5929c8f272c19b76 | |
| parent | 35fe9c604413dc14e9952b5e82294f7122ce6e96 (diff) | |
| download | emacs-4d45a8b7a237e1d33d0ae71d95a0ed7165ea6cda.tar.gz emacs-4d45a8b7a237e1d33d0ae71d95a0ed7165ea6cda.zip | |
Update Killing chapter of manual for Emacs 24 clipboard changes.
* doc/emacs/frames.texi: Move Cut and Paste node and subnodes into
killing.texi, except Mouse Commands and Word and Line Mouse.
* doc/emacs/killing.texi (Killing, Deletion and Killing, Killing by Lines)
(Other Kill Commands, Kill Options): Copyedits.
(Deletion and Killing, Kill Ring): Kill/yank now use clipboard.
(Yanking): Move yank-excluded properties discussion here.
(Cut and Paste): Move from frames.texi. Update subnodes to
describe x-select-enable-clipboard case.
| -rw-r--r-- | doc/emacs/ChangeLog | 12 | ||||
| -rw-r--r-- | doc/emacs/emacs.texi | 18 | ||||
| -rw-r--r-- | doc/emacs/frames.texi | 181 | ||||
| -rw-r--r-- | doc/emacs/killing.texi | 337 |
4 files changed, 283 insertions, 265 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 169796b798b..ae732a7db0f 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2011-07-11 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * killing.texi (Killing, Deletion and Killing, Killing by Lines) | ||
| 4 | (Other Kill Commands, Kill Options): Copyedits. | ||
| 5 | (Deletion and Killing, Kill Ring): Kill/yank now use clipboard. | ||
| 6 | (Yanking): Move yank-excluded properties discussion here. | ||
| 7 | (Cut and Paste): Move from frames.texi. Update subnodes to | ||
| 8 | describe x-select-enable-clipboard case. | ||
| 9 | |||
| 10 | * frames.texi: Move Cut and Paste node and subnodes into | ||
| 11 | killing.texi, except Mouse Commands and Word and Line Mouse. | ||
| 12 | |||
| 1 | 2011-07-10 Andy Moreton <andrewjmoreton@gmail.com> (tiny change) | 13 | 2011-07-10 Andy Moreton <andrewjmoreton@gmail.com> (tiny change) |
| 2 | 14 | ||
| 3 | * makefile.w32-in (EMACSSOURCES): Replace major.texi with modes.texi. | 15 | * makefile.w32-in (EMACSSOURCES): Replace major.texi with modes.texi. |
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 902de8318b8..a35736f4fe7 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi | |||
| @@ -167,6 +167,7 @@ Important Text-Changing Commands | |||
| 167 | * Mark:: The mark: how to delimit a ``region'' of text. | 167 | * Mark:: The mark: how to delimit a ``region'' of text. |
| 168 | * Killing:: Killing (cutting) text. | 168 | * Killing:: Killing (cutting) text. |
| 169 | * Yanking:: Recovering killed text. Moving text. (Pasting.) | 169 | * Yanking:: Recovering killed text. Moving text. (Pasting.) |
| 170 | * Cut and Paste:: Clipboard and selections on graphical displays. | ||
| 170 | * Accumulating Text:: Other ways of copying text. | 171 | * Accumulating Text:: Other ways of copying text. |
| 171 | * Rectangles:: Operating on text in rectangular areas. | 172 | * Rectangles:: Operating on text in rectangular areas. |
| 172 | * CUA Bindings:: Using @kbd{C-x}, @kbd{C-c}, @kbd{C-v} to kill and yank. | 173 | * CUA Bindings:: Using @kbd{C-x}, @kbd{C-c}, @kbd{C-v} to kill and yank. |
| @@ -329,6 +330,12 @@ Yanking | |||
| 329 | * Appending Kills:: Several kills in a row all yank together. | 330 | * Appending Kills:: Several kills in a row all yank together. |
| 330 | * Earlier Kills:: Yanking something killed some time ago. | 331 | * Earlier Kills:: Yanking something killed some time ago. |
| 331 | 332 | ||
| 333 | Killing and Yanking on Graphical Displays | ||
| 334 | |||
| 335 | * Clipboard:: How Emacs interacts with the system clipboard. | ||
| 336 | * Primary Selection:: The temporarily selected text selection. | ||
| 337 | * Secondary Selection:: Cutting without altering point and mark. | ||
| 338 | |||
| 332 | Registers | 339 | Registers |
| 333 | 340 | ||
| 334 | * RegPos:: Saving positions in registers. | 341 | * RegPos:: Saving positions in registers. |
| @@ -493,7 +500,8 @@ Multiple Windows | |||
| 493 | 500 | ||
| 494 | Frames and Graphical Displays | 501 | Frames and Graphical Displays |
| 495 | 502 | ||
| 496 | * Cut and Paste:: Mouse commands for cut and paste. | 503 | * Mouse Commands:: Moving, cutting, and pasting, with the mouse. |
| 504 | * Word and Line Mouse:: Mouse commands for selecting whole words or lines. | ||
| 497 | * Mouse References:: Using the mouse to select an item from a list. | 505 | * Mouse References:: Using the mouse to select an item from a list. |
| 498 | * Menu Mouse Clicks:: Mouse clicks that bring up menus. | 506 | * Menu Mouse Clicks:: Mouse clicks that bring up menus. |
| 499 | * Mode Line Mouse:: Mouse clicks on the mode line. | 507 | * Mode Line Mouse:: Mouse clicks on the mode line. |
| @@ -515,14 +523,6 @@ Frames and Graphical Displays | |||
| 515 | * Non-Window Terminals:: Multiple frames on terminals that show only one. | 523 | * Non-Window Terminals:: Multiple frames on terminals that show only one. |
| 516 | * Text-Only Mouse:: Using the mouse in text-only terminals. | 524 | * Text-Only Mouse:: Using the mouse in text-only terminals. |
| 517 | 525 | ||
| 518 | Killing and Yanking on Graphical Displays | ||
| 519 | |||
| 520 | * Mouse Commands:: Moving, cutting, and pasting, with the mouse. | ||
| 521 | * Word and Line Mouse:: Mouse commands for selecting whole words or lines. | ||
| 522 | * Cut/Paste Other App:: Transfering text between Emacs and other apps. | ||
| 523 | * Secondary Selection:: Cutting without altering point and mark. | ||
| 524 | * Clipboard:: Using the clipboard for selections. | ||
| 525 | |||
| 526 | International Character Set Support | 526 | International Character Set Support |
| 527 | 527 | ||
| 528 | * International Chars:: Basic concepts of multibyte characters. | 528 | * International Chars:: Basic concepts of multibyte characters. |
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 633b65251e4..0fc4dfa427d 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi | |||
| @@ -33,7 +33,8 @@ so that you can use many of the features described in this chapter. | |||
| 33 | @end ifnottex | 33 | @end ifnottex |
| 34 | 34 | ||
| 35 | @menu | 35 | @menu |
| 36 | * Cut and Paste:: Mouse commands for cut and paste. | 36 | * Mouse Commands:: Moving, cutting, and pasting, with the mouse. |
| 37 | * Word and Line Mouse:: Mouse commands for selecting whole words or lines. | ||
| 37 | * Mouse References:: Using the mouse to select an item from a list. | 38 | * Mouse References:: Using the mouse to select an item from a list. |
| 38 | * Menu Mouse Clicks:: Mouse clicks that bring up menus. | 39 | * Menu Mouse Clicks:: Mouse clicks that bring up menus. |
| 39 | * Mode Line Mouse:: Mouse clicks on the mode line. | 40 | * Mode Line Mouse:: Mouse clicks on the mode line. |
| @@ -56,22 +57,8 @@ so that you can use many of the features described in this chapter. | |||
| 56 | * Text-Only Mouse:: Using the mouse in text-only terminals. | 57 | * Text-Only Mouse:: Using the mouse in text-only terminals. |
| 57 | @end menu | 58 | @end menu |
| 58 | 59 | ||
| 59 | @node Cut and Paste | ||
| 60 | @section Cutting and Pasting on Graphical Displays | ||
| 61 | |||
| 62 | This section describes commands for selecting a region, cutting, and | ||
| 63 | pasting using the mouse. | ||
| 64 | |||
| 65 | @menu | ||
| 66 | * Mouse Commands:: Moving, cutting, and pasting, with the mouse. | ||
| 67 | * Word and Line Mouse:: Mouse commands for selecting whole words or lines. | ||
| 68 | * Cut/Paste Other App:: Transfering text between Emacs and other apps. | ||
| 69 | * Secondary Selection:: Cutting without altering point and mark. | ||
| 70 | * Clipboard:: Using the clipboard for selections. | ||
| 71 | @end menu | ||
| 72 | |||
| 73 | @node Mouse Commands | 60 | @node Mouse Commands |
| 74 | @subsection Mouse Commands for Editing | 61 | @section Mouse Commands for Editing |
| 75 | @cindex mouse buttons (what they do) | 62 | @cindex mouse buttons (what they do) |
| 76 | 63 | ||
| 77 | @kindex Mouse-1 | 64 | @kindex Mouse-1 |
| @@ -141,7 +128,7 @@ variable @code{mouse-yank-at-point} to a non-@code{nil} value, | |||
| 141 | @kbd{Mouse-2} does not move point. Then it does not matter where you | 128 | @kbd{Mouse-2} does not move point. Then it does not matter where you |
| 142 | click, or even which of the frame's windows you click on; the yank | 129 | click, or even which of the frame's windows you click on; the yank |
| 143 | occurs at the existing point. This variable also affects yanking the | 130 | occurs at the existing point. This variable also affects yanking the |
| 144 | primary and secondary selections (@pxref{Cut/Paste Other App}). | 131 | primary and secondary selections (@pxref{Primary Selection}). |
| 145 | 132 | ||
| 146 | @findex mouse-save-then-kill | 133 | @findex mouse-save-then-kill |
| 147 | Clicking with the right mouse button, @kbd{Mouse-3}, runs the | 134 | Clicking with the right mouse button, @kbd{Mouse-3}, runs the |
| @@ -195,7 +182,7 @@ make Emacs behave this way by enabling Delete Selection mode. | |||
| 195 | @xref{Using Region}. | 182 | @xref{Using Region}. |
| 196 | 183 | ||
| 197 | @node Word and Line Mouse | 184 | @node Word and Line Mouse |
| 198 | @subsection Mouse Commands for Words and Lines | 185 | @section Mouse Commands for Words and Lines |
| 199 | 186 | ||
| 200 | These variants of @kbd{Mouse-1} select entire words or lines at a | 187 | These variants of @kbd{Mouse-1} select entire words or lines at a |
| 201 | time. Emacs activates the region around the selected text, which is | 188 | time. Emacs activates the region around the selected text, which is |
| @@ -224,164 +211,6 @@ Select the line you click on. | |||
| 224 | Select the text you drag across, in the form of whole lines. | 211 | Select the text you drag across, in the form of whole lines. |
| 225 | @end table | 212 | @end table |
| 226 | 213 | ||
| 227 | @node Cut/Paste Other App | ||
| 228 | @subsection Cut and Paste with Other Window Applications | ||
| 229 | |||
| 230 | @cindex X cutting and pasting | ||
| 231 | @cindex X selection | ||
| 232 | @cindex primary selection | ||
| 233 | @cindex selection, primary | ||
| 234 | When running Emacs under the X window system, you can easily | ||
| 235 | transfer text between Emacs and other X applications using the | ||
| 236 | @dfn{primary selection} (also called the @dfn{X selection}). This is | ||
| 237 | @emph{not} the same thing as the @dfn{clipboard}, which is a separate | ||
| 238 | facility used on desktop environments such as Gnome, and on operating | ||
| 239 | systems such as Microsoft Windows (@pxref{Clipboard}). | ||
| 240 | |||
| 241 | Under X, whenever you select some text in Emacs by dragging or | ||
| 242 | clicking the mouse (@pxref{Mouse Commands}), it is also saved in the | ||
| 243 | primary selection. You can then @dfn{paste} that text into any other | ||
| 244 | X application, usually by clicking @kbd{Mouse-2} in that application. | ||
| 245 | Unlike the Emacs kill ring (@pxref{Kill Ring}), the primary selection | ||
| 246 | has no ``memory'': each time you save something in the primary | ||
| 247 | selection, either in Emacs or in another X application, the previous | ||
| 248 | contents of the primary selection are lost. | ||
| 249 | |||
| 250 | @cindex MS-Windows, and primary selection | ||
| 251 | MS-Windows provides no primary selection, but Emacs emulates it | ||
| 252 | within a single Emacs session, by storing the selected text | ||
| 253 | internally. Therefore, all the features and commands related to the | ||
| 254 | primary selection work on Windows as they do on X, for cutting and | ||
| 255 | pasting within the same session, but not across Emacs sessions or with | ||
| 256 | other applications. | ||
| 257 | |||
| 258 | Whenever you kill some text using a command such as @kbd{C-w} | ||
| 259 | (@code{kill-region}), or copy it into the kill ring using a command | ||
| 260 | such as @kbd{M-w} (@code{kill-ring-save}), that text is also saved in | ||
| 261 | the primary selection. @xref{Killing}. | ||
| 262 | |||
| 263 | @vindex select-active-regions | ||
| 264 | If you set the region using the keyboard---for instance, by typing | ||
| 265 | @kbd{C-@key{SPC}} and moving point away from the mark---the text in | ||
| 266 | the region is not normally saved to the primary selection. However, | ||
| 267 | if you change the variable @code{select-active-regions} to @code{t}, | ||
| 268 | the region is saved to the primary selection whenever you activate the | ||
| 269 | mark. Each change to the region also updates the primary selection. | ||
| 270 | |||
| 271 | @vindex yank-pop-change-selection | ||
| 272 | If you change @code{yank-pop-change-selection} to @code{t}, rotating | ||
| 273 | the kill ring with @kbd{M-y} (@code{yank-pop}) also saves the new yank | ||
| 274 | to the primary selection (@pxref{Yanking}). | ||
| 275 | |||
| 276 | @vindex save-interprogram-paste-before-kill | ||
| 277 | If you change @code{save-interprogram-paste-before-kill} to | ||
| 278 | @code{t}, each kill command first saves the existing selection onto | ||
| 279 | the kill ring. This prevents you from losing the existing selection, | ||
| 280 | at the risk of large memory consumption if other applications generate | ||
| 281 | large selections. | ||
| 282 | |||
| 283 | You can yank the primary selection into Emacs using the usual yank | ||
| 284 | commands, such as @kbd{C-y} (@code{yank}) and @kbd{Mouse-2} | ||
| 285 | (@code{mouse-yank-at-click}). These commands actually check the | ||
| 286 | primary selection before referring to the kill ring; if no primary | ||
| 287 | selection is available, the kill ring contents are used. To prevent | ||
| 288 | yank commands from accessing the primary selection, set the variable | ||
| 289 | @code{x-select-enable-primary} to @code{nil}. | ||
| 290 | |||
| 291 | The standard coding system for the primary selection is | ||
| 292 | @code{compound-text-with-extensions}. You may find that the pasted | ||
| 293 | text is not what you expected. In such a case, you can specify | ||
| 294 | another coding system for the selection by typing @kbd{C-x @key{RET} | ||
| 295 | x} or @kbd{C-x @key{RET} X}. Alternatively, you can request a | ||
| 296 | different data type by modifying the variable | ||
| 297 | @code{x-select-request-type}. @xref{Communication Coding}. | ||
| 298 | |||
| 299 | @node Secondary Selection | ||
| 300 | @subsection Secondary Selection | ||
| 301 | @cindex secondary selection | ||
| 302 | |||
| 303 | In addition to the primary selection, the X Window System provides a | ||
| 304 | second similar facility known as the @dfn{secondary selection}. | ||
| 305 | Nowadays, few X applications make use of the secondary selection, but | ||
| 306 | you can access it using the following Emacs commands: | ||
| 307 | |||
| 308 | @table @kbd | ||
| 309 | @findex mouse-set-secondary | ||
| 310 | @kindex M-Drag-Mouse-1 | ||
| 311 | @item M-Drag-Mouse-1 | ||
| 312 | Set the secondary selection, with one end at the place where you press | ||
| 313 | down the button, and the other end at the place where you release it | ||
| 314 | (@code{mouse-set-secondary}). The selected text is highlighted, using | ||
| 315 | the @code{secondary-selection} face, as you drag. The window scrolls | ||
| 316 | automatically if you drag the mouse off the top or bottom of the | ||
| 317 | window, just like @code{mouse-set-region} (@pxref{Mouse Commands}). | ||
| 318 | |||
| 319 | This command does not alter the kill ring. | ||
| 320 | |||
| 321 | @findex mouse-start-secondary | ||
| 322 | @kindex M-Mouse-1 | ||
| 323 | @item M-Mouse-1 | ||
| 324 | Set one endpoint for the @dfn{secondary selection} | ||
| 325 | (@code{mouse-start-secondary}). | ||
| 326 | |||
| 327 | @findex mouse-secondary-save-then-kill | ||
| 328 | @kindex M-Mouse-3 | ||
| 329 | @item M-Mouse-3 | ||
| 330 | Set the secondary selection, with one end at the position clicked and | ||
| 331 | the other at the position specified with @kbd{M-Mouse-1} | ||
| 332 | (@code{mouse-secondary-save-then-kill}). This also puts the selected | ||
| 333 | text in the kill ring. A second @kbd{M-Mouse-3} at the same place | ||
| 334 | kills the secondary selection just made. | ||
| 335 | |||
| 336 | @findex mouse-yank-secondary | ||
| 337 | @kindex M-Mouse-2 | ||
| 338 | @item M-Mouse-2 | ||
| 339 | Insert the secondary selection where you click, placing point at the | ||
| 340 | end of the yanked text (@code{mouse-yank-secondary}). | ||
| 341 | @end table | ||
| 342 | |||
| 343 | Double or triple clicking of @kbd{M-Mouse-1} operates on words and | ||
| 344 | lines, much like @kbd{Mouse-1}. | ||
| 345 | |||
| 346 | If @code{mouse-yank-at-point} is non-@code{nil}, @kbd{M-Mouse-2} yanks | ||
| 347 | at point. Then it does not matter precisely where you click, or even | ||
| 348 | which of the frame's windows you click on. @xref{Mouse Commands}. | ||
| 349 | |||
| 350 | @node Clipboard | ||
| 351 | @subsection Using the Clipboard | ||
| 352 | @cindex clipboard | ||
| 353 | |||
| 354 | In desktop environments such as Gnome, and operating systems such as | ||
| 355 | Microsoft Windows and Mac OS X, you can transfer data (usually text) | ||
| 356 | between different applications using the @dfn{clipboard}. The | ||
| 357 | clipboard is distinct from the primary selection and secondary | ||
| 358 | selection discussed earlier. You can access the clipboard through the | ||
| 359 | @samp{Edit} menu of the menu bar (@pxref{Menu Bar}). | ||
| 360 | |||
| 361 | @cindex cut | ||
| 362 | @findex clipboard-kill-region | ||
| 363 | The command @code{clipboard-kill-region}, which is bound to the | ||
| 364 | @code{Cut} menu item, kills the region and saves it in the clipboard. | ||
| 365 | |||
| 366 | @cindex copy | ||
| 367 | @findex clipboard-kill-ring-save | ||
| 368 | The command @code{clipboard-kill-ring-save}, which is bound to the | ||
| 369 | @code{Copy} menu item, copies the region to the kill ring and saves it | ||
| 370 | in the clipboard. | ||
| 371 | |||
| 372 | @findex clipboard-yank | ||
| 373 | @cindex paste | ||
| 374 | The @code{Paste} menu item in the Edit menu yanks the contents of | ||
| 375 | the clipboard at point (@code{clipboard-yank}). | ||
| 376 | |||
| 377 | @vindex x-select-enable-clipboard | ||
| 378 | You can customize the variable @code{x-select-enable-clipboard} to | ||
| 379 | make the Emacs yank functions consult the clipboard before the primary | ||
| 380 | selection, and to make the kill functions to store in the clipboard as | ||
| 381 | well as the primary selection. Otherwise, these commands do not | ||
| 382 | access the clipboard at all. Using the clipboard is the default on | ||
| 383 | MS-Windows and Mac OS, but not on other systems. | ||
| 384 | |||
| 385 | @node Mouse References | 214 | @node Mouse References |
| 386 | @section Following References with the Mouse | 215 | @section Following References with the Mouse |
| 387 | @kindex Mouse-1 @r{(selection)} | 216 | @kindex Mouse-1 @r{(selection)} |
diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi index 2ee2bd9be05..38124fc315a 100644 --- a/doc/emacs/killing.texi +++ b/doc/emacs/killing.texi | |||
| @@ -6,17 +6,21 @@ | |||
| 6 | @node Killing, Registers, Mark, Top | 6 | @node Killing, Registers, Mark, Top |
| 7 | @chapter Killing and Moving Text | 7 | @chapter Killing and Moving Text |
| 8 | 8 | ||
| 9 | @dfn{Killing} means erasing text and copying it into the @dfn{kill | 9 | In Emacs, @dfn{killing} means erasing text and copying it into the |
| 10 | ring}, from which you can bring it back into the buffer by | 10 | @dfn{kill ring}. @dfn{Yanking} means bringing text from the kill ring |
| 11 | @dfn{yanking} it. (Some applications use the terms ``cutting'' and | 11 | back into the buffer. (Some applications use the terms ``cutting'' |
| 12 | ``pasting'' for similar operations.) This is the most common way of | 12 | and ``pasting'' for similar operations.) The kill ring is so-named |
| 13 | moving or copying text within Emacs. It is very versatile, because | 13 | because it can be visualized as a set of blocks of text arranged in a |
| 14 | there are commands for killing many different types of syntactic | 14 | ring, which you can access in cyclic order. @xref{Kill Ring}. |
| 15 | units. | 15 | |
| 16 | Killing and yanking are the most common way to move or copy text | ||
| 17 | within Emacs. It is very versatile, because there are commands for | ||
| 18 | killing many different types of syntactic units. | ||
| 16 | 19 | ||
| 17 | @menu | 20 | @menu |
| 18 | * Deletion and Killing:: Commands that remove text. | 21 | * Deletion and Killing:: Commands that remove text. |
| 19 | * Yanking:: Commands that insert text. | 22 | * Yanking:: Commands that insert text. |
| 23 | * Cut and Paste:: Clipboard and selections on graphical displays. | ||
| 20 | * Accumulating Text:: Other methods to add text to the buffer. | 24 | * Accumulating Text:: Other methods to add text to the buffer. |
| 21 | * Rectangles:: Operating on text in rectangular areas. | 25 | * Rectangles:: Operating on text in rectangular areas. |
| 22 | * CUA Bindings:: Using @kbd{C-x}/@kbd{C-c}/@kbd{C-v} to kill and yank. | 26 | * CUA Bindings:: Using @kbd{C-x}/@kbd{C-c}/@kbd{C-v} to kill and yank. |
| @@ -29,25 +33,28 @@ units. | |||
| 29 | @cindex cutting text | 33 | @cindex cutting text |
| 30 | @cindex deletion | 34 | @cindex deletion |
| 31 | Most commands which erase text from the buffer save it in the kill | 35 | Most commands which erase text from the buffer save it in the kill |
| 32 | ring. These are known as @dfn{kill} commands. The kill ring stores | 36 | ring. These are known as @dfn{kill} commands, and their names |
| 33 | several recent kills, not just the last one, so killing is a very safe | 37 | normally contain the word @samp{kill} (e.g. @code{kill-line}). The |
| 34 | operation: when you make a new kill, you don't have to worry much | 38 | kill ring stores several recent kills, not just the last one, so |
| 35 | about losing text that you previously killed. | 39 | killing is a very safe operation: you don't have to worry much about |
| 40 | losing text that you previously killed. The kill ring is shared by | ||
| 41 | all buffers, so text that is killed in one buffer can be yanked into | ||
| 42 | another buffer. | ||
| 43 | |||
| 44 | When you use @kbd{C-/} (@code{undo}) to undo a kill command | ||
| 45 | (@pxref{Undo}), that brings the killed text back into the buffer, but | ||
| 46 | does not remove it from the kill ring. | ||
| 36 | 47 | ||
| 37 | You can yank text from the kill ring into any position in a buffer, | 48 | On graphical displays, killing text also copies it to the system |
| 38 | including a position in a different buffer; the kill ring is shared by | 49 | clipboard. @xref{Cut and Paste}. |
| 39 | all buffers. The @kbd{C-/} (@code{undo}) command can undo both kill | ||
| 40 | and delete commands (@pxref{Undo}); the importance of the kill ring is | ||
| 41 | that you can yank the text in a different place. | ||
| 42 | 50 | ||
| 43 | Commands that erase text but do not save it in the kill ring are | 51 | Commands that erase text but do not save it in the kill ring are |
| 44 | known as @dfn{delete} commands. These include @kbd{C-d} | 52 | known as @dfn{delete} commands; their names usually contain the word |
| 45 | (@code{delete-char}) and @key{DEL} (@code{delete-backward-char}), | 53 | @samp{delete}. These include @kbd{C-d} (@code{delete-char}) and |
| 46 | which delete only one character at a time, and those commands that | 54 | @key{DEL} (@code{delete-backward-char}), which delete only one |
| 47 | delete only spaces or newlines. Commands that can erase significant | 55 | character at a time, and those commands that delete only spaces or |
| 48 | amounts of nontrivial data generally do a kill operation instead. The | 56 | newlines. Commands that can erase significant amounts of nontrivial |
| 49 | commands' names and individual descriptions use the words @samp{kill} | 57 | data generally do a kill operation instead. |
| 50 | and @samp{delete} to say which kind of operation they perform. | ||
| 51 | 58 | ||
| 52 | You can also use the mouse to kill and yank. @xref{Cut and Paste}. | 59 | You can also use the mouse to kill and yank. @xref{Cut and Paste}. |
| 53 | 60 | ||
| @@ -127,21 +134,22 @@ Kill an entire line at once (@code{kill-whole-line}) | |||
| 127 | 134 | ||
| 128 | @kindex C-k | 135 | @kindex C-k |
| 129 | @findex kill-line | 136 | @findex kill-line |
| 130 | The simplest kill command is @kbd{C-k}. If given at the beginning | 137 | The simplest kill command is @kbd{C-k} (@code{kill-line}). If used |
| 131 | of a line, it kills all the text on the line@footnote{Here, ``line'' | 138 | at the end of a line, it kills the line-ending newline character, |
| 132 | means a logical text line, not a screen line. @xref{Continuation | 139 | merging the next line into the current one (thus, a blank line is |
| 133 | Lines}.}, leaving it blank. When used on a blank line, it kills the | 140 | entirely removed). Otherwise, @kbd{C-k} kills all the text from point |
| 134 | whole line including its newline. | 141 | up to the end of the line; if point was originally at the beginning of |
| 135 | 142 | the line, this leaves the line blank. | |
| 136 | More precisely, @kbd{C-k} kills from point up to the end of the | 143 | |
| 137 | line, unless it is at the end of a line. In that case it kills the | 144 | Spaces and tabs at the end of the line are ignored when deciding |
| 138 | newline following point, thus merging the next line into the current | 145 | which case applies. As long as point is after the last visible |
| 139 | one. Spaces and tabs at the end of the line are ignored when deciding | ||
| 140 | which case applies, so as long as point is after the last visible | ||
| 141 | character in the line, you can be sure that @kbd{C-k} will kill the | 146 | character in the line, you can be sure that @kbd{C-k} will kill the |
| 142 | newline. To kill an entire non-blank line, go to the beginning and | 147 | newline. To kill an entire non-blank line, go to the beginning and |
| 143 | type @kbd{C-k} twice. | 148 | type @kbd{C-k} twice. |
| 144 | 149 | ||
| 150 | In this context, ``line'' means a logical text line, not a screen | ||
| 151 | line (@pxref{Continuation Lines}). | ||
| 152 | |||
| 145 | When @kbd{C-k} is given a positive argument @var{n}, it kills | 153 | When @kbd{C-k} is given a positive argument @var{n}, it kills |
| 146 | @var{n} lines and the newlines that follow them (text on the current | 154 | @var{n} lines and the newlines that follow them (text on the current |
| 147 | line before point is not killed). With a negative argument | 155 | line before point is not killed). With a negative argument |
| @@ -157,10 +165,10 @@ following newline. This variable is normally @code{nil}. | |||
| 157 | 165 | ||
| 158 | @kindex C-S-backspace | 166 | @kindex C-S-backspace |
| 159 | @findex kill-whole-line | 167 | @findex kill-whole-line |
| 160 | @kbd{C-S-backspace} (@code{kill-whole-line}) will kill a whole line | 168 | @kbd{C-S-backspace} (@code{kill-whole-line}) kills a whole line |
| 161 | including its newline regardless of the position of point within the | 169 | including its newline, regardless of the position of point within the |
| 162 | line. Note that many character terminals will prevent you from typing | 170 | line. Note that many text terminals will prevent you from typing the |
| 163 | the key sequence @kbd{C-S-backspace}. | 171 | key sequence @kbd{C-S-backspace}. |
| 164 | 172 | ||
| 165 | @node Other Kill Commands | 173 | @node Other Kill Commands |
| 166 | @subsection Other Kill Commands | 174 | @subsection Other Kill Commands |
| @@ -196,10 +204,8 @@ last set. The mark is deactivated at the end of the command. | |||
| 196 | 204 | ||
| 197 | @kindex M-w | 205 | @kindex M-w |
| 198 | @findex kill-ring-save | 206 | @findex kill-ring-save |
| 199 | The command @kbd{M-w} (@code{kill-ring-save}) copies the region into | 207 | @kbd{M-w} (@code{kill-ring-save}) copies the region into the kill |
| 200 | the kill ring without removing it from the buffer. This is | 208 | ring without removing it from the buffer. |
| 201 | approximately equivalent to @kbd{C-w} followed by @kbd{C-/}, except | ||
| 202 | that @kbd{M-w} does not alter the undo history. | ||
| 203 | 209 | ||
| 204 | Emacs also provides commands to kill specific syntactic units: | 210 | Emacs also provides commands to kill specific syntactic units: |
| 205 | words, with @kbd{M-@key{DEL}} and @kbd{M-d} (@pxref{Words}); balanced | 211 | words, with @kbd{M-@key{DEL}} and @kbd{M-d} (@pxref{Words}); balanced |
| @@ -220,12 +226,10 @@ search backward and kill text before point. | |||
| 220 | @vindex kill-read-only-ok | 226 | @vindex kill-read-only-ok |
| 221 | @cindex read-only text, killing | 227 | @cindex read-only text, killing |
| 222 | Some specialized buffers contain @dfn{read-only text}, which cannot | 228 | Some specialized buffers contain @dfn{read-only text}, which cannot |
| 223 | be modified and therefore cannot be killed. But some users like to | 229 | be modified and therefore cannot be killed. The kill commands work |
| 224 | use the kill commands to copy read-only text into the kill ring, | 230 | specially in a read-only buffer: they move over text and copy it to |
| 225 | without actually changing it. Therefore, the kill commands work | ||
| 226 | specially in a read-only buffer: they move over text, and copy it to | ||
| 227 | the kill ring, without actually deleting it from the buffer. | 231 | the kill ring, without actually deleting it from the buffer. |
| 228 | Normally, kill commands beep and display an error message when this | 232 | Normally, they also beep and display an error message when this |
| 229 | happens. But if you set the variable @code{kill-read-only-ok} to a | 233 | happens. But if you set the variable @code{kill-read-only-ok} to a |
| 230 | non-@code{nil} value, they just print a message in the echo area to | 234 | non-@code{nil} value, they just print a message in the echo area to |
| 231 | explain why the text has not been erased. | 235 | explain why the text has not been erased. |
| @@ -257,10 +261,16 @@ Replace text just yanked with an earlier batch of killed text | |||
| 257 | Append next kill to last batch of killed text (@code{append-next-kill}). | 261 | Append next kill to last batch of killed text (@code{append-next-kill}). |
| 258 | @end table | 262 | @end table |
| 259 | 263 | ||
| 260 | On graphical displays with window systems, if there is a current | 264 | @cindex yanking and text properties |
| 261 | selection in some other application, and you selected it more recently | 265 | @vindex yank-excluded-properties |
| 262 | than you killed any text in Emacs, @kbd{C-y} copies the selection | 266 | The yank commands discard certain properties from the yanked text. |
| 263 | instead of text killed within Emacs. | 267 | These are properties that might lead to annoying results, such as |
| 268 | causing the text to respond to the mouse or specifying key bindings. | ||
| 269 | The list of properties to discard is stored in the variable | ||
| 270 | @code{yank-excluded-properties}. These properties are also discarded | ||
| 271 | when yanking register contents and rectangles. @xref{Text | ||
| 272 | Properties,,, elisp, the Emacs Lisp Reference Manual}, for more | ||
| 273 | information about text properties. | ||
| 264 | 274 | ||
| 265 | @menu | 275 | @menu |
| 266 | * Kill Ring:: Where killed text is stored. Basic yanking. | 276 | * Kill Ring:: Where killed text is stored. Basic yanking. |
| @@ -271,38 +281,34 @@ instead of text killed within Emacs. | |||
| 271 | @node Kill Ring | 281 | @node Kill Ring |
| 272 | @subsection The Kill Ring | 282 | @subsection The Kill Ring |
| 273 | 283 | ||
| 274 | All killed text is recorded in the @dfn{kill ring}, a list of blocks | 284 | The @dfn{kill ring} is a list of blocks of text that were previously |
| 275 | of text that have been killed. There is only one kill ring, shared by | 285 | killed. There is only one kill ring, shared by all buffers, so you |
| 276 | all buffers, so you can kill text in one buffer and yank it in another | 286 | can kill text in one buffer and yank it in another buffer. This is |
| 277 | buffer. This is the usual way to move text from one file to another. | 287 | the usual way to move text from one file to another. (There are |
| 278 | (There are several other methods: for instance, you could store the | 288 | several other methods: for instance, you could store the text in a |
| 279 | text in a register. @xref{Registers}, for information about | 289 | register; see @ref{Registers}. @xref{Accumulating Text}, for some |
| 280 | registers. @xref{Accumulating Text}, for some other ways to move text | 290 | other ways to move text around.) |
| 281 | around.) | ||
| 282 | 291 | ||
| 283 | @kindex C-y | 292 | @kindex C-y |
| 284 | @findex yank | 293 | @findex yank |
| 285 | The command @kbd{C-y} (@code{yank}) reinserts the text of the most | 294 | @kbd{C-y} (@code{yank}) reinserts the text of the most recent kill, |
| 286 | recent kill, leaving the cursor at the end of the text. It also adds | 295 | leaving the cursor at the end of the text. It also adds the position |
| 287 | the position of the beginning of the text to the mark ring, without | 296 | of the beginning of the text to the mark ring, without activating the |
| 288 | activating the mark; this allows you to jump easily to that position | 297 | mark; this allows you to jump easily to that position with @kbd{C-x |
| 289 | with @kbd{C-x C-x} (@pxref{Setting Mark}). With a plain prefix | 298 | C-x} (@pxref{Setting Mark}). |
| 290 | argument (@kbd{C-u C-y}), it instead leaves the cursor in front of the | 299 | |
| 291 | text, and adds the position of the end of the text to the mark ring. | 300 | On graphical displays, @kbd{C-y} first checks if another application |
| 292 | Using other sort of prefix argument specifies an earlier kill; for | 301 | has placed any text in the system clipboard more recently than the |
| 293 | example, @kbd{C-u 4 C-y} reinserts the fourth most recent kill. | 302 | last Emacs kill. If so, it inserts from the clipboard instead of the |
| 294 | @xref{Earlier Kills}. | 303 | kill ring. Conceptually, you can think of the clipboard as an |
| 295 | 304 | ``extra'' entry in the kill ring, which is present if you recently cut | |
| 296 | @cindex yanking and text properties | 305 | or copied some text in another application. @xref{Cut and Paste}. |
| 297 | @vindex yank-excluded-properties | 306 | |
| 298 | The yank commands discard certain properties from the yanked text. | 307 | With a plain prefix argument (@kbd{C-u C-y}), the @code{yank} |
| 299 | These are properties that might lead to annoying results, such as | 308 | command instead leaves the cursor in front of the text, and adds the |
| 300 | causing the text to respond to the mouse or specifying key bindings. | 309 | position of the end of the text to the mark ring. Using any other |
| 301 | The list of properties to discard is stored in the variable | 310 | prefix argument specifies an earlier kill; for example, @kbd{C-u 4 |
| 302 | @code{yank-excluded-properties}. Yanking of register contents and | 311 | C-y} reinserts the fourth most recent kill. @xref{Earlier Kills}. |
| 303 | rectangles also discard these properties. @xref{Text Properties,,, | ||
| 304 | elisp, the Emacs Lisp Reference Manual}, for more information about | ||
| 305 | text properties. | ||
| 306 | 312 | ||
| 307 | @node Appending Kills | 313 | @node Appending Kills |
| 308 | @subsection Appending Kills | 314 | @subsection Appending Kills |
| @@ -418,6 +424,177 @@ saved. | |||
| 418 | @code{kill-ring}; you can view the entire contents of the kill ring with | 424 | @code{kill-ring}; you can view the entire contents of the kill ring with |
| 419 | the command @kbd{C-h v kill-ring}. | 425 | the command @kbd{C-h v kill-ring}. |
| 420 | 426 | ||
| 427 | @node Cut and Paste | ||
| 428 | @section ``Cut and Paste'' Operations on Graphical Displays | ||
| 429 | @cindex cut | ||
| 430 | @cindex copy | ||
| 431 | @cindex paste | ||
| 432 | |||
| 433 | In most graphical desktop environments, you can transfer data | ||
| 434 | (usually text) between different applications using a system facility | ||
| 435 | called the @dfn{clipboard}. On X, two other similar facilities are | ||
| 436 | available: the primary selection and the secondary selection. When | ||
| 437 | Emacs is run on a graphical display, its kill and yank commands | ||
| 438 | integrate with these facilities, so that you can easily transfer text | ||
| 439 | between Emacs and other graphical applications. | ||
| 440 | |||
| 441 | By default, Emacs uses UTF-8 as the coding system for inter-program | ||
| 442 | text transfers. If you find that the pasted text is not what you | ||
| 443 | expected, you can specify another coding system by typing @kbd{C-x | ||
| 444 | @key{RET} x} or @kbd{C-x @key{RET} X}. You can also request a | ||
| 445 | different data type by customizing @code{x-select-request-type}. | ||
| 446 | @xref{Communication Coding}. | ||
| 447 | |||
| 448 | @menu | ||
| 449 | * Clipboard:: How Emacs uses the system clipboard. | ||
| 450 | * Primary Selection:: The temporarily selected text selection. | ||
| 451 | * Secondary Selection:: Cutting without altering point and mark. | ||
| 452 | @end menu | ||
| 453 | |||
| 454 | @node Clipboard | ||
| 455 | @subsection Using the Clipboard | ||
| 456 | @cindex clipboard | ||
| 457 | |||
| 458 | The @dfn{clipboard} is the facility that most graphical applications | ||
| 459 | use for ``cutting and pasting''. When the clipboard exists, the kill | ||
| 460 | and yank commands in Emacs make use of it. | ||
| 461 | |||
| 462 | When you kill some text with a command such as @kbd{C-w} | ||
| 463 | (@code{kill-region}), or copy it to the kill ring with a command such | ||
| 464 | as @kbd{M-w} (@code{kill-ring-save}), that text is also put in the | ||
| 465 | clipboard. @xref{Killing}. | ||
| 466 | |||
| 467 | @vindex save-interprogram-paste-before-kill | ||
| 468 | When an Emacs kill command puts text in the clipboard, the existing | ||
| 469 | clipboard contents are normally lost. Optionally, you can change | ||
| 470 | @code{save-interprogram-paste-before-kill} to @code{t}. Then Emacs | ||
| 471 | will first save the clipboard to its kill ring, preventing you from | ||
| 472 | losing the old clipboard data---at the risk of high memory consumption | ||
| 473 | if that data turns out to be large. | ||
| 474 | |||
| 475 | The usual yank commands, such as @kbd{C-y} (@code{yank}), also use | ||
| 476 | the clipboard. If another application ``owns'' the clipboard---i.e., | ||
| 477 | if you cut or copied text there more recently than your last kill | ||
| 478 | command in Emacs---then Emacs yanks from the clipboard instead of the | ||
| 479 | kill ring. Otherwise, it yanks from the kill ring, as described in | ||
| 480 | @ref{Yanking}. | ||
| 481 | |||
| 482 | @vindex yank-pop-change-selection | ||
| 483 | Normally, rotating the kill ring with @kbd{M-y} (@code{yank-pop}) | ||
| 484 | does not alter the clipboard. However, if you change | ||
| 485 | @code{yank-pop-change-selection} to @code{t}, then @kbd{M-y} saves the | ||
| 486 | new yank to the clipboard. | ||
| 487 | |||
| 488 | @vindex x-select-enable-clipboard | ||
| 489 | To prevent kill and yank commands from accessing the clipboard, | ||
| 490 | change the variable @code{x-select-enable-clipboard} to @code{nil}. | ||
| 491 | |||
| 492 | @vindex x-select-enable-primary | ||
| 493 | @findex clipboard-kill-region | ||
| 494 | @findex clipboard-kill-ring-save | ||
| 495 | @findex clipboard-yank | ||
| 496 | Prior to Emacs 24, the kill and yank commands used the primary | ||
| 497 | selection (@pxref{Primary Selection}), not the clipboard. If you | ||
| 498 | prefer this behavior, change @code{x-select-enable-clipboard} to | ||
| 499 | @code{nil}, @code{x-select-enable-primary} to @code{t}, and | ||
| 500 | @code{mouse-drag-copy-region} to @code{t}. In this case, you can use | ||
| 501 | the following commands to act explicitly on the clipboard: | ||
| 502 | @code{clipboard-kill-region} kills the region and saves it to the | ||
| 503 | clipboard; @code{clipboard-kill-ring-save} copies the region to the | ||
| 504 | kill ring and saves it to the clipboard; and @code{clipboard-yank} | ||
| 505 | yanks the contents of the clipboard at point. | ||
| 506 | |||
| 507 | @node Primary Selection | ||
| 508 | @subsection Cut and Paste with Other Window Applications | ||
| 509 | @cindex X cutting and pasting | ||
| 510 | @cindex X selection | ||
| 511 | @cindex primary selection | ||
| 512 | @cindex selection, primary | ||
| 513 | |||
| 514 | Under the X window system, there exists a @dfn{primary selection} | ||
| 515 | containing the last stretch of text selected in an X application | ||
| 516 | (usually by dragging the mouse). Typically, this text can be inserted | ||
| 517 | into other X applications by @kbd{mouse-2} clicks. The primary | ||
| 518 | selection is separate from the clipboard (@pxref{Clipboard}). Its | ||
| 519 | contents are more ``fragile''; they are overwritten by any mouse | ||
| 520 | selection, whereas the clipboard is only overwritten by explicit | ||
| 521 | ``cut'' or ``copy'' commands. | ||
| 522 | |||
| 523 | Under X, whenever you select some text in Emacs by dragging or | ||
| 524 | clicking the mouse (@pxref{Mouse Commands}), it is also saved to the | ||
| 525 | primary selection. | ||
| 526 | |||
| 527 | @vindex select-active-regions | ||
| 528 | If you set the region using the keyboard---for instance, by typing | ||
| 529 | @kbd{C-@key{SPC}} and moving point away from the mark---the text in | ||
| 530 | the region is also saved to the primary selection. (The updating of | ||
| 531 | the primary selection is done at the end of each command, as long as | ||
| 532 | the region is active and non-empty.) To disable this behavior, change | ||
| 533 | the variable @code{select-active-regions} to @code{nil}. | ||
| 534 | |||
| 535 | To insert the primary selection into an Emacs buffer, click | ||
| 536 | @kbd{mouse-2} (@code{mouse-yank-primary}) where you want to insert it. | ||
| 537 | @xref{Mouse Commands}. | ||
| 538 | |||
| 539 | @cindex MS-Windows, and primary selection | ||
| 540 | MS-Windows provides no primary selection, but Emacs emulates it | ||
| 541 | within a single Emacs session by storing the selected text internally. | ||
| 542 | Therefore, all the features and commands related to the primary | ||
| 543 | selection work on Windows as they do on X, for cutting and pasting | ||
| 544 | within the same session, but not across Emacs sessions or with other | ||
| 545 | applications. | ||
| 546 | |||
| 547 | @node Secondary Selection | ||
| 548 | @subsection Secondary Selection | ||
| 549 | @cindex secondary selection | ||
| 550 | |||
| 551 | In addition to the primary selection, the X Window System provides a | ||
| 552 | second similar facility known as the @dfn{secondary selection}. | ||
| 553 | Nowadays, few X applications make use of the secondary selection, but | ||
| 554 | you can access it using the following Emacs commands: | ||
| 555 | |||
| 556 | @table @kbd | ||
| 557 | @findex mouse-set-secondary | ||
| 558 | @kindex M-Drag-Mouse-1 | ||
| 559 | @item M-Drag-Mouse-1 | ||
| 560 | Set the secondary selection, with one end at the place where you press | ||
| 561 | down the button, and the other end at the place where you release it | ||
| 562 | (@code{mouse-set-secondary}). The selected text is highlighted, using | ||
| 563 | the @code{secondary-selection} face, as you drag. The window scrolls | ||
| 564 | automatically if you drag the mouse off the top or bottom of the | ||
| 565 | window, just like @code{mouse-set-region} (@pxref{Mouse Commands}). | ||
| 566 | |||
| 567 | This command does not alter the kill ring. | ||
| 568 | |||
| 569 | @findex mouse-start-secondary | ||
| 570 | @kindex M-Mouse-1 | ||
| 571 | @item M-Mouse-1 | ||
| 572 | Set one endpoint for the @dfn{secondary selection} | ||
| 573 | (@code{mouse-start-secondary}). | ||
| 574 | |||
| 575 | @findex mouse-secondary-save-then-kill | ||
| 576 | @kindex M-Mouse-3 | ||
| 577 | @item M-Mouse-3 | ||
| 578 | Set the secondary selection, with one end at the position clicked and | ||
| 579 | the other at the position specified with @kbd{M-Mouse-1} | ||
| 580 | (@code{mouse-secondary-save-then-kill}). This also puts the selected | ||
| 581 | text in the kill ring. A second @kbd{M-Mouse-3} at the same place | ||
| 582 | kills the secondary selection just made. | ||
| 583 | |||
| 584 | @findex mouse-yank-secondary | ||
| 585 | @kindex M-Mouse-2 | ||
| 586 | @item M-Mouse-2 | ||
| 587 | Insert the secondary selection where you click, placing point at the | ||
| 588 | end of the yanked text (@code{mouse-yank-secondary}). | ||
| 589 | @end table | ||
| 590 | |||
| 591 | Double or triple clicking of @kbd{M-Mouse-1} operates on words and | ||
| 592 | lines, much like @kbd{Mouse-1}. | ||
| 593 | |||
| 594 | If @code{mouse-yank-at-point} is non-@code{nil}, @kbd{M-Mouse-2} yanks | ||
| 595 | at point. Then it does not matter precisely where you click, or even | ||
| 596 | which of the frame's windows you click on. @xref{Mouse Commands}. | ||
| 597 | |||
| 421 | @node Accumulating Text | 598 | @node Accumulating Text |
| 422 | @section Accumulating Text | 599 | @section Accumulating Text |
| 423 | @findex append-to-buffer | 600 | @findex append-to-buffer |