Lines Matching +refs:copy +refs:region +refs:as +refs:kill

10 @dfn{kill ring}.  @dfn{Yanking} means bringing text from the kill ring
12 and ``pasting'' for similar operations.) The kill ring is so-named
13 because it can be visualized as a set of blocks of text arranged in a
16 Killing and yanking are the most common way to move or copy text
26 * CUA Bindings:: Using @kbd{C-x}/@kbd{C-c}/@kbd{C-v} to kill and yank.
35 Most commands which erase text from the buffer save it in the kill
36 ring (@pxref{Kill Ring}). These are known as @dfn{kill} commands, and
37 their names normally contain the word @samp{kill} (e.g.,
38 @code{kill-line}). The kill ring stores several recent kills, not
40 to worry much about losing text that you previously killed. The kill
44 When you use @kbd{C-/} (@code{undo}) to undo a kill command
46 does not remove it from the kill ring.
51 Commands that erase text but do not save it in the kill ring are
52 known as @dfn{delete} commands; their names usually contain the word
57 data generally do a kill operation instead.
59 You can also use the mouse to kill and yank. @xref{Cut and Paste}.
64 * Killing by Lines:: How to kill entire lines of text at one time.
65 * Other Kill Commands:: Commands to kill large regions of text and
66 syntactic units such as words and sentences.
75 Deletion means erasing text and not saving it in the kill ring. For
82 Delete the previous character, or the text in the region if it is
86 Delete the next character, or the text in the region if it is active
109 @key{DEL} and @key{delete} delete all the text in the region if it is
135 blank lines preceding the current line as well (leaving one blank line,
144 The command @code{delete-duplicate-lines} searches the region for
145 identical lines, and removes all but one copy of each. Normally it
158 Kill rest of line or one or more lines (@code{kill-line}).
160 Kill an entire line at once (@code{kill-whole-line})
164 @findex kill-line
165 The simplest kill command is @kbd{C-k} (@code{kill-line}). If used
173 which case applies. As long as point is after the last non-whitespace
174 character in the line, you can be sure that @kbd{C-k} will kill the
175 newline. To kill an entire non-blank line, go to the beginning and
189 @vindex kill-whole-line
190 If the variable @code{kill-whole-line} is non-@code{nil}, @kbd{C-k} at
195 @findex kill-whole-line
196 @kbd{C-S-backspace} (@code{kill-whole-line}) kills a whole line
206 Kill the region (@code{kill-region}).
208 Copy the region into the kill ring (@code{kill-ring-save}).
210 Kill the next word (@code{kill-word}). @xref{Words}.
212 Kill one word backwards (@code{backward-kill-word}).
214 Kill back to beginning of sentence (@code{backward-kill-sentence}).
217 Kill to the end of the sentence (@code{kill-sentence}).
219 Kill the following balanced expression (@code{kill-sexp}). @xref{Expressions}.
227 @findex kill-region
229 @findex kill-ring-save
230 One of the commonly-used kill commands is @kbd{C-w}
231 (@code{kill-region}), which kills the text in the region
232 (@pxref{Mark}). Similarly, @kbd{M-w} (@code{kill-ring-save}) copies
233 the text in the region into the kill ring without removing it from the
238 Emacs also provides commands to kill specific syntactic units:
248 numeric argument acts as a repeat count; a negative argument means to
249 search backward and kill text before point. A history of previously
256 argument acting as a repeat count.
261 @vindex kill-read-only-ok
264 be modified and therefore cannot be killed. The kill commands work
265 specially in a read-only buffer: they move over text and copy it to
266 the kill ring, without actually deleting it from the buffer.
268 happens. But if you set the variable @code{kill-read-only-ok} to a
272 @vindex kill-do-not-save-duplicates
273 If you change the variable @code{kill-do-not-save-duplicates} to a
275 kill-ring entry, without duplication.
281 @cindex kill ring
286 way to move or copy text is to kill it and then yank it elsewhere.
290 Yank the last kill into the buffer, at point (@code{yank}).
295 Cause the following command, if it is a kill command, to append to the
296 previous kill (@code{append-next-kill}). @xref{Appending Kills}.
302 the most recent kill, leaving the cursor at the end of the inserted
309 the end. Using any other prefix argument specifies an earlier kill;
310 e.g., @kbd{C-u 4 C-y} reinserts the fourth most recent kill.
315 last Emacs kill. If so, it inserts the clipboard's text instead.
316 Thus, Emacs effectively treats ``cut'' or ``copy'' clipboard
318 that they are not recorded in the kill ring. @xref{Cut and Paste},
330 The @dfn{kill ring} is a list of blocks of text that were previously
331 killed. There is only one kill ring, shared by all buffers, so you
332 can kill text in one buffer and yank it in another buffer. This is
338 @vindex kill-ring-max
339 The maximum number of entries in the kill ring is controlled by the
340 variable @code{kill-ring-max}. The default is 60. If you make a new
341 kill when this limit has been reached, Emacs makes room by deleting
342 the oldest entry in the kill ring.
344 @vindex kill-ring
345 The actual contents of the kill ring are stored in a variable named
346 @code{kill-ring}; you can view the entire contents of the kill ring
347 with @kbd{C-h v kill-ring}.
354 @kbd{C-y} to yank text that is no longer the most recent kill. This
355 is useful if you remember which kill ring entry you want. If you
362 that was yanked and replaces it with the text from an earlier kill.
363 So, to recover the text of the next-to-the-last kill, first use
364 @kbd{C-y} to yank the last kill, and then use @kbd{M-y} to replace it
365 with the previous kill. @kbd{M-y} is allowed only after a @kbd{C-y}
369 points at an entry in the kill ring. Each time you kill, the last-yank
380 the most recent kill at the front to the oldest one still remembered.
388 stop doing @kbd{M-y} commands and it will stay there. It's just a copy
389 of the kill ring entry, so editing it in the buffer does not change
390 what's in the ring. As long as no new killing is done, the last-yank
391 pointer remains at the same place in the kill ring, so repeating
392 @kbd{C-y} will yank another copy of the same previous kill.
401 Normally, each kill command pushes a new entry onto the kill ring.
402 However, two or more kill commands in a row combine their text into a
403 single entry, so that a single @kbd{C-y} yanks all the text as a unit,
404 just as it was before it was killed.
406 Thus, if you want to yank text as a unit, you need not kill all of it
411 Commands that kill forward from point add onto the end of the previous
412 killed text. Commands that kill backward from point add text onto the
413 beginning. This way, any sequence of mixed forward and backward kill
425 @samp{a line of sample} as one entry in the kill ring, and
430 Another way to kill the same text is to move back two words with
431 @kbd{M-b M-b}, then kill all four words forward with @kbd{C-u M-d}.
432 This produces exactly the same results in the buffer and in the kill
434 backward; once again, the result is the same. The text in the kill ring
439 @findex append-next-kill
440 If a kill command is separated from the last kill command by other
442 kill ring. But you can force it to combine with the last killed text,
443 by typing @kbd{C-M-w} (@code{append-next-kill}) right beforehand. The
444 @kbd{C-M-w} tells its following command, if it is a kill command, to
445 treat the kill as part of the sequence of previous kills. As usual,
446 the kill is appended to the previous killed text if the command kills
448 you can kill several separated pieces of text and accumulate them to
451 A kill command following @kbd{M-w} (@code{kill-ring-save}) does not
452 append to the text that @kbd{M-w} copied into the kill ring.
457 @cindex copy
464 Emacs is run on a graphical display, its kill and yank commands
468 By default, Emacs uses UTF-8 as the coding system for inter-program
486 use for ``cutting and pasting''. When the clipboard exists, the kill
489 When you kill some text with a command such as @kbd{C-w}
490 (@code{kill-region}), or copy it to the kill ring with a command such
491 as @kbd{M-w} (@code{kill-ring-save}), that text is also put in the
494 @vindex save-interprogram-paste-before-kill
495 When an Emacs kill command puts text in the clipboard, the existing
497 @code{save-interprogram-paste-before-kill} to @code{t}. Then Emacs
498 will first save the clipboard to its kill ring, preventing you from
502 Yank commands, such as @kbd{C-y} (@code{yank}), also use the
504 you cut or copied text there more recently than your last kill command
505 in Emacs---then Emacs yanks from the clipboard instead of the kill
509 Normally, rotating the kill ring with @kbd{M-y} (@code{yank-pop})
515 To prevent kill and yank commands from accessing the clipboard,
534 @findex clipboard-kill-region
535 @findex clipboard-kill-ring-save
537 Prior to Emacs 24, the kill and yank commands used the primary
541 @code{mouse-drag-copy-region} to @code{t}. In this case, you can use
543 @code{clipboard-kill-region} kills the region and saves it to the
544 clipboard; @code{clipboard-kill-ring-save} copies the region to the
545 kill ring and saves it to the clipboard; and @code{clipboard-yank}
562 or copy commands.
564 Under X, whenever the region is active (@pxref{Mark}), the text in
565 the region is saved in the primary selection. This applies regardless
566 of whether the region was made by dragging or clicking the mouse
586 selection work on Windows as they do on X, for cutting and pasting
595 second similar facility known as the @dfn{secondary selection}.
607 the @code{secondary-selection} face, as you drag. The window scrolls
609 window, just like @code{mouse-set-region} (@pxref{Mouse Commands}).
611 This command does not alter the kill ring.
621 @findex mouse-secondary-save-then-kill
624 Set the secondary selection (@code{mouse-secondary-save-then-kill}),
627 puts the selected text in the kill ring. A second @kbd{M-mouse-3} at
649 @findex copy-to-buffer
653 Usually we copy or move text by killing it and yanking it, but there
661 Append region to the contents of a specified buffer.
663 Prepend region to the contents of a specified buffer.
664 @item M-x copy-to-buffer
665 Copy region into a specified buffer, deleting that buffer's old contents.
669 Append region to the contents of a specified file, at the end.
673 This reads a buffer name, then inserts a copy of the region into the
682 specified buffer in the same order as they were copied. Strictly
691 copy-to-buffer} is similar, except that any existing text in the other
697 buffer, and inserts a copy of all the text in that buffer into the
705 a filename, and adds the text of the region to the end of the
724 range of lines. Emacs has commands to kill rectangles, yank killed
730 @cindex region-rectangle
731 @cindex rectangular region
734 is called the @dfn{region-rectangle}. If point and the mark are in
735 the same column, the region-rectangle is empty. If they are in the
736 same line, the region-rectangle is one line high.
738 The region-rectangle is controlled in much the same way as the
739 region is controlled. But remember that a given combination of point
740 and mark values can be interpreted either as a region or as a
743 A rectangular region can also be marked using the mouse: click and drag
748 Kill the text of the region-rectangle, saving its contents as the
749 last killed rectangle (@code{kill-rectangle}).
751 Save the text of the region-rectangle as the last killed rectangle
752 (@code{copy-rectangle-as-kill}).
754 Delete the text of the region-rectangle (@code{delete-rectangle}).
759 Insert blank space to fill the space of the region-rectangle
761 region-rectangle to the right.
763 Insert line numbers along the left edge of the region-rectangle
765 the region-rectangle to the right.
767 Clear the region-rectangle by replacing all of its contents with spaces
779 When this mode is active, the region-rectangle is highlighted and can
780 be shrunk/grown, and the standard kill and yank commands operate on it.
788 @findex kill-rectangle
792 k} (@code{kill-rectangle}) to remove the text and save it as the
794 region-rectangle is like erasing the specified text on each line of
799 rectangle is not stored in the kill ring, but in a special place that
806 @findex copy-rectangle-as-kill
807 @kbd{C-x r M-w} (@code{copy-rectangle-as-kill}) is the equivalent of
808 @kbd{M-w} for rectangles: it records the rectangle as the last
820 double-column list by killing one of the single-column lists as a
823 You can also copy rectangles into and out of registers with @kbd{C-x r
832 region-rectangle, and @kbd{C-x r o} (@code{open-rectangle}) inserts a
845 line numbers along the left edge of the region-rectangle. Normally,
855 contents of a region-rectangle with a string on each line. The
856 string's width need not be the same as the width of the rectangle. If
868 whether the region-rectangle or the standard region is highlighted
869 (first activating the region if necessary). When this mode is enabled,
870 commands that resize the region (@kbd{C-f}, @kbd{C-n} etc.)@: do
872 rectangle. @xref{Killing}. The mode persists only as long as the
873 region is active.
875 Unlike the standard region, the region-rectangle can have its corners
883 When the region is in rectangle-mark-mode, @kbd{C-x C-x} runs the
885 the four corners of the region-rectangle. This comes in handy if you
886 want to modify the dimensions of the region-rectangle before invoking
900 and @kbd{C-z} invoke commands that cut (kill), copy, paste (yank), and
902 copy only if the region is active. Otherwise, they still act as
917 so that typed text replaces the active region. To use CUA without this
923 extend it using the movement commands, and cut or copy it using
927 of each line in the rectangle (on the same side as the cursor).
933 With CUA you can easily copy text and rectangles into and out of
934 registers by providing a one-digit numeric prefix to the kill, copy,
935 and yank commands, e.g., @kbd{C-1 C-c} copies the region into register
942 kill or copy is automatically inserted at the global mark, and text
946 For example, to copy words from various buffers into a word list in
949 @kbd{S-M-f}), copy it to the list with @kbd{C-c} or @kbd{M-w}, and