annotate doc/emacs/killing.texi @ 112417:a2432c16dc9f

compile.el fix for bug#7812 * lisp/progmodes/compile.el (compilation-error-regexp-alist): Fix custom type.
author Glenn Morris <rgm@gnu.org>
date Thu, 20 Jan 2011 21:04:45 -0800
parents 376148b31b5e
children 417b1e4d63cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
1 @c This is part of the Emacs manual.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
112218
376148b31b5e Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents: 109262
diff changeset
3 @c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
109262
51ddcf320fe4 Untabify doc/emacs/*.texi files.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
4 @c Free Software Foundation, Inc.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
5 @c See file emacs.texi for copying conditions.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
6
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
7 @node Killing, Yanking, Mark, Top
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
8 @chapter Killing and Moving Text
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
9
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
10 @ifnottex
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
11 @raisesections
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
12 @end ifnottex
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
13
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
14 @dfn{Killing} means erasing text and copying it into the @dfn{kill
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
15 ring}, from which you can bring it back into the buffer by
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
16 @dfn{yanking} it. (Some applications use the terms ``cutting'' and
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
17 ``pasting'' for similar operations.) This is the most common way of
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
18 moving or copying text within Emacs. It is very versatile, because
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
19 there are commands for killing many different types of syntactic
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
20 units.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
21
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
22 @iftex
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
23 @section Deletion and Killing
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
24 @end iftex
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
25
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
26 @cindex killing text
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
27 @cindex cutting text
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
28 @cindex deletion
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
29 Most commands which erase text from the buffer save it in the kill
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
30 ring. These are known as @dfn{kill} commands. The kill ring stores
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
31 several recent kills, not just the last one, so killing is a very safe
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
32 operation: when you make a new kill, you don't have to worry much
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
33 about losing text that you previously killed.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
34
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
35 You can yank text from the kill ring into any position in a buffer,
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
36 including a position in a different buffer; the kill ring is shared by
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
37 all buffers. The @kbd{C-/} (@code{undo}) command can undo both kill
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
38 and delete commands (@pxref{Undo}); the importance of the kill ring is
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
39 that you can yank the text in a different place.
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
40
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
41 Commands that erase text but do not save it in the kill ring are
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
42 known as @dfn{delete} commands. These include @kbd{C-d}
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
43 (@code{delete-char}) and @key{DEL} (@code{delete-backward-char}),
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
44 which delete only one character at a time, and those commands that
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
45 delete only spaces or newlines. Commands that can erase significant
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
46 amounts of nontrivial data generally do a kill operation instead. The
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
47 commands' names and individual descriptions use the words @samp{kill}
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
48 and @samp{delete} to say which kind of operation they perform.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
49
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
50 You can also use the mouse to kill and yank. @xref{Cut and Paste}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
51
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
52 @menu
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
53 * Deletion:: Commands for deleting small amounts of text and
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
54 blank areas.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
55 * Killing by Lines:: How to kill entire lines of text at one time.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
56 * Other Kill Commands:: Commands to kill large regions of text and
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
57 syntactic units such as words and sentences.
106636
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
58 * Kill Options:: Options that affect killing.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
59 @end menu
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
60
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
61 @node Deletion
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
62 @subsection Deletion
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
63 @findex delete-backward-char
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
64 @findex delete-char
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
65
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
66 Deletion means erasing text and not saving it in the kill ring. For
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
67 the most part, the Emacs commands that delete text are those that
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
68 erase just one character or only whitespace.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
69
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
70 @table @kbd
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
71 @item C-d
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
72 @itemx @key{Delete}
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
73 Delete next character (@code{delete-char}).
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
74 @item @key{DEL}
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
75 @itemx @key{Backspace}
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
76 Delete previous character (@code{delete-backward-char}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
77 @item M-\
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
78 Delete spaces and tabs around point (@code{delete-horizontal-space}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
79 @item M-@key{SPC}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
80 Delete spaces and tabs around point, leaving one space
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
81 (@code{just-one-space}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
82 @item C-x C-o
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
83 Delete blank lines around the current line (@code{delete-blank-lines}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
84 @item M-^
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
85 Join two lines by deleting the intervening newline, along with any
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
86 indentation following it (@code{delete-indentation}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
87 @end table
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
88
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
89 We have already described the basic deletion commands @kbd{C-d}
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
90 (@code{delete-char}) and @key{DEL} (@code{delete-backward-char}).
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
91 @xref{Erasing}.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
92
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
93 @kindex M-\
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
94 @findex delete-horizontal-space
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
95 @kindex M-SPC
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
96 @findex just-one-space
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
97 The other delete commands are those that delete only whitespace
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
98 characters: spaces, tabs and newlines. @kbd{M-\}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
99 (@code{delete-horizontal-space}) deletes all the spaces and tab
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
100 characters before and after point. With a prefix argument, this only
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
101 deletes spaces and tab characters before point. @kbd{M-@key{SPC}}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
102 (@code{just-one-space}) does likewise but leaves a single space after
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
103 point, regardless of the number of spaces that existed previously
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
104 (even if there were none before). With a numeric argument @var{n}, it
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
105 leaves @var{n} spaces after point.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
106
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
107 @kbd{C-x C-o} (@code{delete-blank-lines}) deletes all blank lines
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
108 after the current line. If the current line is blank, it deletes all
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
109 blank lines preceding the current line as well (leaving one blank line,
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
110 the current line). On a solitary blank line, it deletes that line.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
111
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
112 @kbd{M-^} (@code{delete-indentation}) joins the current line and the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
113 previous line, by deleting a newline and all surrounding spaces, usually
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
114 leaving a single space. @xref{Indentation,M-^}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
115
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
116 @node Killing by Lines
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
117 @subsection Killing by Lines
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
118
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
119 @table @kbd
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
120 @item C-k
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
121 Kill rest of line or one or more lines (@code{kill-line}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
122 @item C-S-backspace
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
123 Kill an entire line at once (@code{kill-whole-line})
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
124 @end table
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
125
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
126 @kindex C-k
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
127 @findex kill-line
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
128 The simplest kill command is @kbd{C-k}. If given at the beginning
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
129 of a line, it kills all the text on the line@footnote{Here, ``line''
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
130 means a logical text line, not a screen line. @xref{Continuation
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
131 Lines}.}, leaving it blank. When used on a blank line, it kills the
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
132 whole line including its newline.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
133
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
134 More precisely, @kbd{C-k} kills from point up to the end of the
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
135 line, unless it is at the end of a line. In that case it kills the
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
136 newline following point, thus merging the next line into the current
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
137 one. Spaces and tabs at the end of the line are ignored when deciding
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
138 which case applies, so as long as point is after the last visible
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
139 character in the line, you can be sure that @kbd{C-k} will kill the
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
140 newline. To kill an entire non-blank line, go to the beginning and
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
141 type @kbd{C-k} twice.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
142
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
143 When @kbd{C-k} is given a positive argument @var{n}, it kills
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
144 @var{n} lines and the newlines that follow them (text on the current
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
145 line before point is not killed). With a negative argument
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
146 @minus{}@var{n}, it kills @var{n} lines preceding the current line,
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
147 together with the text on the current line before point. @kbd{C-k}
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
148 with an argument of zero kills the text before point on the current
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
149 line.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
150
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
151 @vindex kill-whole-line
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
152 If the variable @code{kill-whole-line} is non-@code{nil}, @kbd{C-k} at
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
153 the very beginning of a line kills the entire line including the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
154 following newline. This variable is normally @code{nil}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
155
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
156 @kindex C-S-backspace
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
157 @findex kill-whole-line
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
158 @kbd{C-S-backspace} (@code{kill-whole-line}) will kill a whole line
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
159 including its newline regardless of the position of point within the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
160 line. Note that many character terminals will prevent you from typing
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
161 the key sequence @kbd{C-S-backspace}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
162
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
163 @node Other Kill Commands
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
164 @subsection Other Kill Commands
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
165 @findex kill-region
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
166 @kindex C-w
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
167
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
168 @table @kbd
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
169 @item C-w
93356
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
170 Kill region (@code{kill-region}). @xref{Mark}.
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
171 @item M-w
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
172 Save region as last killed text without actually killing it
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
173 (@code{kill-ring-save}). Some programs call this ``copying.''
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
174 @item M-d
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
175 Kill word (@code{kill-word}). @xref{Words}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
176 @item M-@key{DEL}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
177 Kill word backwards (@code{backward-kill-word}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
178 @item C-x @key{DEL}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
179 Kill back to beginning of sentence (@code{backward-kill-sentence}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
180 @xref{Sentences}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
181 @item M-k
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
182 Kill to end of sentence (@code{kill-sentence}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
183 @item C-M-k
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
184 Kill the following balanced expression (@code{kill-sexp}). @xref{Expressions}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
185 @item M-z @var{char}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
186 Kill through the next occurrence of @var{char} (@code{zap-to-char}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
187 @end table
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
188
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
189 Apart from @kbd{C-k}, the most commonly-used kill command is
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
190 @kbd{C-w} (@code{kill-region}), which kills the text in the region
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
191 (i.e., between point and mark). @xref{Mark}. If the mark is inactive
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
192 when you type @kbd{C-w}, it first reactivates the mark where it was
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
193 last set. The mark is deactivated at the end of the command.
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
194
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
195 @kindex M-w
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
196 @findex kill-ring-save
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
197 The command @kbd{M-w} (@code{kill-ring-save}) copies the region into
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
198 the kill ring without removing it from the buffer. This is
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
199 approximately equivalent to @kbd{C-w} followed by @kbd{C-/}, except
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
200 that @kbd{M-w} does not alter the undo history.
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
201
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
202 Emacs also provides commands to kill specific syntactic units:
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
203 words, with @kbd{M-@key{DEL}} and @kbd{M-d} (@pxref{Words}); balanced
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
204 expressions, with @kbd{C-M-k} (@pxref{Expressions}); and sentences,
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
205 with @kbd{C-x @key{DEL}} and @kbd{M-k} (@pxref{Sentences}).
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
206
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
207 @kindex M-z
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
208 @findex zap-to-char
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
209 The command @kbd{M-z} (@code{zap-to-char}) combines killing with
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
210 searching: it reads a character and kills from point up to (and
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
211 including) the next occurrence of that character in the buffer. A
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
212 numeric argument acts as a repeat count; a negative argument means to
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
213 search backward and kill text before point.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
214
106636
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
215 @node Kill Options
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
216 @subsection Options for Killing
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
217
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
218 @vindex kill-read-only-ok
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
219 @cindex read-only text, killing
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
220 Some specialized buffers contain @dfn{read-only text}, which cannot
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
221 be modified and therefore cannot be killed. But some users like to
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
222 use the kill commands to copy read-only text into the kill ring,
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
223 without actually changing it. Therefore, the kill commands work
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
224 specially in a read-only buffer: they move over text, and copy it to
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
225 the kill ring, without actually deleting it from the buffer.
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
226 Normally, kill commands beep and display an error message when this
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
227 happens. But if you set the variable @code{kill-read-only-ok} to a
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
228 non-@code{nil} value, they just print a message in the echo area to
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
229 explain why the text has not been erased.
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
230
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
231 @vindex kill-do-not-save-duplicates
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
232 If you change the variable @code{kill-do-not-save-duplicates} to a
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
233 non-@code{nil} value, identical subsequent kills yield a single
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
234 kill-ring entry, without duplication.
6c68929f170b * emacs.texi (Top): Update node listing.
Chong Yidong <cyd@stupidchicken.com>
parents: 100974
diff changeset
235
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
236 @node Yanking, Accumulating Text, Killing, Top
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
237 @section Yanking
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
238 @cindex moving text
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
239 @cindex copying text
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
240 @cindex kill ring
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
241 @cindex yanking
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
242 @cindex pasting
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
243
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
244 @dfn{Yanking} means reinserting text previously killed. The usual
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
245 way to move or copy text is to kill it and then yank it elsewhere one
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
246 or more times.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
247
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
248 @table @kbd
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
249 @item C-y
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
250 Yank last killed text (@code{yank}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
251 @item M-y
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
252 Replace text just yanked with an earlier batch of killed text
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
253 (@code{yank-pop}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
254 @item C-M-w
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
255 Append next kill to last batch of killed text (@code{append-next-kill}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
256 @end table
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
257
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
258 On graphical displays with window systems, if there is a current
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
259 selection in some other application, and you selected it more recently
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
260 than you killed any text in Emacs, @kbd{C-y} copies the selection
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
261 instead of text killed within Emacs.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
262
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
263 @menu
109262
51ddcf320fe4 Untabify doc/emacs/*.texi files.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
264 * Kill Ring:: Where killed text is stored. Basic yanking.
51ddcf320fe4 Untabify doc/emacs/*.texi files.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
265 * Appending Kills:: Several kills in a row all yank together.
51ddcf320fe4 Untabify doc/emacs/*.texi files.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
266 * Earlier Kills:: Yanking something killed some time ago.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
267 @end menu
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
268
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
269 @node Kill Ring
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
270 @subsection The Kill Ring
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
271
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
272 All killed text is recorded in the @dfn{kill ring}, a list of blocks
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
273 of text that have been killed. There is only one kill ring, shared by
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
274 all buffers, so you can kill text in one buffer and yank it in another
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
275 buffer. This is the usual way to move text from one file to another.
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
276 (There are several other methods: for instance, you could store the
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
277 text in a register. @xref{Registers}, for information about
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
278 registers. @xref{Accumulating Text}, for some other ways to move text
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
279 around.)
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
280
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
281 @kindex C-y
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
282 @findex yank
93356
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
283 The command @kbd{C-y} (@code{yank}) reinserts the text of the most
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
284 recent kill, leaving the cursor at the end of the text. It also adds
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
285 the position of the beginning of the text to the mark ring, without
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
286 activating the mark; this allows you to jump easily to that position
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
287 with @kbd{C-x C-x} (@pxref{Setting Mark}). With a plain prefix
93356
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
288 argument (@kbd{C-u C-y}), it instead leaves the cursor in front of the
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
289 text, and adds the position of the end of the text to the mark ring.
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
290 Using other sort of prefix argument specifies an earlier kill; for
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
291 example, @kbd{C-u 4 C-y} reinserts the fourth most recent kill.
93361
88a7af29767c Fix typo.
Chong Yidong <cyd@stupidchicken.com>
parents: 93356
diff changeset
292 @xref{Earlier Kills}.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
293
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
294 @cindex yanking and text properties
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
295 @vindex yank-excluded-properties
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
296 The yank commands discard certain properties from the yanked text.
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
297 These are properties that might lead to annoying results, such as
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
298 causing the text to respond to the mouse or specifying key bindings.
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
299 The list of properties to discard is stored in the variable
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
300 @code{yank-excluded-properties}. Yanking of register contents and
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
301 rectangles also discard these properties. @xref{Text Properties,,,
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
302 elisp, the Emacs Lisp Reference Manual}, for more information about
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
303 text properties.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
304
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
305 @node Appending Kills
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
306 @subsection Appending Kills
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
307
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
308 @cindex appending kills in the ring
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
309 Normally, each kill command pushes a new entry onto the kill ring.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
310 However, two or more kill commands in a row combine their text into a
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
311 single entry, so that a single @kbd{C-y} yanks all the text as a unit,
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
312 just as it was before it was killed.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
313
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
314 Thus, if you want to yank text as a unit, you need not kill all of it
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
315 with one command; you can keep killing line after line, or word after
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
316 word, until you have killed it all, and you can still get it all back at
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
317 once.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
318
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
319 Commands that kill forward from point add onto the end of the previous
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
320 killed text. Commands that kill backward from point add text onto the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
321 beginning. This way, any sequence of mixed forward and backward kill
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
322 commands puts all the killed text into one entry without rearrangement.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
323 Numeric arguments do not break the sequence of appending kills. For
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
324 example, suppose the buffer contains this text:
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
325
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
326 @example
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
327 This is a line @point{}of sample text.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
328 @end example
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
329
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
330 @noindent
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
331 with point shown by @point{}. If you type @kbd{M-d M-@key{DEL} M-d
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
332 M-@key{DEL}}, killing alternately forward and backward, you end up with
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
333 @samp{a line of sample} as one entry in the kill ring, and @samp{This
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
334 is@ @ text.} in the buffer. (Note the double space between @samp{is}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
335 and @samp{text}, which you can clean up with @kbd{M-@key{SPC}} or
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
336 @kbd{M-q}.)
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
337
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
338 Another way to kill the same text is to move back two words with
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
339 @kbd{M-b M-b}, then kill all four words forward with @kbd{C-u M-d}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
340 This produces exactly the same results in the buffer and in the kill
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
341 ring. @kbd{M-f M-f C-u M-@key{DEL}} kills the same text, all going
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
342 backward; once again, the result is the same. The text in the kill ring
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
343 entry always has the same order that it had in the buffer before you
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
344 killed it.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
345
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
346 @kindex C-M-w
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
347 @findex append-next-kill
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
348 If a kill command is separated from the last kill command by other
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
349 commands (not just numeric arguments), it starts a new entry on the kill
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
350 ring. But you can force it to append by first typing the command
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
351 @kbd{C-M-w} (@code{append-next-kill}) right before it. The @kbd{C-M-w}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
352 tells the following command, if it is a kill command, to append the text
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
353 it kills to the last killed text, instead of starting a new entry. With
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
354 @kbd{C-M-w}, you can kill several separated pieces of text and
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
355 accumulate them to be yanked back in one place.@refill
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
356
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
357 A kill command following @kbd{M-w} (@code{kill-ring-save}) does not
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
358 append to the text that @kbd{M-w} copied into the kill ring.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
359
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
360 @node Earlier Kills
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
361 @subsection Yanking Earlier Kills
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
362
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
363 @cindex yanking previous kills
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
364 @kindex M-y
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
365 @findex yank-pop
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
366 To recover killed text that is no longer the most recent kill, use the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
367 @kbd{M-y} command (@code{yank-pop}). It takes the text previously
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
368 yanked and replaces it with the text from an earlier kill. So, to
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
369 recover the text of the next-to-the-last kill, first use @kbd{C-y} to
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
370 yank the last kill, and then use @kbd{M-y} to replace it with the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
371 previous kill. @kbd{M-y} is allowed only after a @kbd{C-y} or another
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
372 @kbd{M-y}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
373
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
374 You can understand @kbd{M-y} in terms of a ``last yank'' pointer which
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
375 points at an entry in the kill ring. Each time you kill, the ``last
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
376 yank'' pointer moves to the newly made entry at the front of the ring.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
377 @kbd{C-y} yanks the entry which the ``last yank'' pointer points to.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
378 @kbd{M-y} moves the ``last yank'' pointer to a different entry, and the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
379 text in the buffer changes to match. Enough @kbd{M-y} commands can move
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
380 the pointer to any entry in the ring, so you can get any entry into the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
381 buffer. Eventually the pointer reaches the end of the ring; the next
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
382 @kbd{M-y} loops back around to the first entry again.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
383
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
384 @kbd{M-y} moves the ``last yank'' pointer around the ring, but it does
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
385 not change the order of the entries in the ring, which always runs from
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
386 the most recent kill at the front to the oldest one still remembered.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
387
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
388 @kbd{M-y} can take a numeric argument, which tells it how many entries
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
389 to advance the ``last yank'' pointer by. A negative argument moves the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
390 pointer toward the front of the ring; from the front of the ring, it
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
391 moves ``around'' to the last entry and continues forward from there.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
392
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
393 Once the text you are looking for is brought into the buffer, you can
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
394 stop doing @kbd{M-y} commands and it will stay there. It's just a copy
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
395 of the kill ring entry, so editing it in the buffer does not change
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
396 what's in the ring. As long as no new killing is done, the ``last
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
397 yank'' pointer remains at the same place in the kill ring, so repeating
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
398 @kbd{C-y} will yank another copy of the same previous kill.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
399
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
400 If you know how many @kbd{M-y} commands it would take to find the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
401 text you want, you can yank that text in one step using @kbd{C-y} with
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
402 a numeric argument. @kbd{C-y} with an argument restores the text from
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
403 the specified kill ring entry, counting back from the most recent as
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
404 1. Thus, @kbd{C-u 2 C-y} gets the next-to-the-last block of killed
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
405 text---it is equivalent to @kbd{C-y M-y}. @kbd{C-y} with a numeric
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
406 argument starts counting from the ``last yank'' pointer, and sets the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
407 ``last yank'' pointer to the entry that it yanks.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
408
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
409 @vindex kill-ring-max
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
410 The length of the kill ring is controlled by the variable
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
411 @code{kill-ring-max}; no more than that many blocks of killed text are
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
412 saved.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
413
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
414 @vindex kill-ring
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
415 The actual contents of the kill ring are stored in a variable named
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
416 @code{kill-ring}; you can view the entire contents of the kill ring with
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
417 the command @kbd{C-h v kill-ring}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
418
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
419 @node Accumulating Text, Rectangles, Yanking, Top
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
420 @section Accumulating Text
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
421 @findex append-to-buffer
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
422 @findex prepend-to-buffer
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
423 @findex copy-to-buffer
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
424 @findex append-to-file
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
425
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
426 @cindex accumulating scattered text
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
427 Usually we copy or move text by killing it and yanking it, but there
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
428 are other convenient methods for copying one block of text in many
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
429 places, or for copying many scattered blocks of text into one place.
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
430 Here we describe the commands to accumulate scattered pieces of text
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
431 into a buffer or into a file.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
432
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
433 @table @kbd
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
434 @item M-x append-to-buffer
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
435 Append region to the contents of a specified buffer.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
436 @item M-x prepend-to-buffer
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
437 Prepend region to the contents of a specified buffer.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
438 @item M-x copy-to-buffer
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
439 Copy region into a specified buffer, deleting that buffer's old contents.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
440 @item M-x insert-buffer
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
441 Insert the contents of a specified buffer into current buffer at point.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
442 @item M-x append-to-file
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
443 Append region to the contents of a specified file, at the end.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
444 @end table
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
445
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
446 To accumulate text into a buffer, use @kbd{M-x append-to-buffer}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
447 This reads a buffer name, then inserts a copy of the region into the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
448 buffer specified. If you specify a nonexistent buffer,
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
449 @code{append-to-buffer} creates the buffer. The text is inserted
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
450 wherever point is in that buffer. If you have been using the buffer for
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
451 editing, the copied text goes into the middle of the text of the buffer,
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
452 starting from wherever point happens to be at that moment.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
453
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
454 Point in that buffer is left at the end of the copied text, so
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
455 successive uses of @code{append-to-buffer} accumulate the text in the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
456 specified buffer in the same order as they were copied. Strictly
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
457 speaking, @code{append-to-buffer} does not always append to the text
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
458 already in the buffer---it appends only if point in that buffer is at the end.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
459 However, if @code{append-to-buffer} is the only command you use to alter
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
460 a buffer, then point is always at the end.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
461
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
462 @kbd{M-x prepend-to-buffer} is just like @code{append-to-buffer}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
463 except that point in the other buffer is left before the copied text, so
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
464 successive prependings add text in reverse order. @kbd{M-x
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
465 copy-to-buffer} is similar, except that any existing text in the other
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
466 buffer is deleted, so the buffer is left containing just the text newly
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
467 copied into it.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
468
93356
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
469 The command @kbd{M-x insert-buffer} can be used to retrieve the
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
470 accumulated text from another buffer. This prompts for the name of a
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
471 buffer, and inserts a copy of all the text in that buffer into the
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
472 current buffer at point, leaving point at the beginning of the
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
473 inserted text. It also adds the position of the end of the inserted
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
474 text to the mark ring, without activating the mark. @xref{Buffers},
be3d519700ee (Kill Ring, Accumulating Text): Assume Transient Mark mode is the
Chong Yidong <cyd@stupidchicken.com>
parents: 87903
diff changeset
475 for background information on buffers.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
476
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
477 Instead of accumulating text in a buffer, you can append text
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
478 directly into a file with @kbd{M-x append-to-file}. This prompts for
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
479 a filename, and adds the text of the region to the end of the
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
480 specified file. The file is changed immediately on disk.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
481
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
482 You should use @code{append-to-file} only with files that are
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
483 @emph{not} being visited in Emacs. Using it on a file that you are
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
484 editing in Emacs would change the file behind Emacs's back, which
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
485 can lead to losing some of your editing.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
486
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
487 Another way to move text around is to store it in a register.
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
488 @xref{Registers}.
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
489
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
490 @node Rectangles, CUA Bindings, Accumulating Text, Top
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
491 @section Rectangles
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
492 @cindex rectangle
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
493 @cindex columns (and rectangles)
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
494 @cindex killing rectangular areas of text
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
495
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
496 @dfn{Rectangle} commands operate on rectangular areas of the text:
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
497 all the characters between a certain pair of columns, in a certain
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
498 range of lines. Emacs has commands to kill rectangles, yank killed
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
499 rectangles, clear them out, fill them with blanks or text, or delete
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
500 them. Rectangle commands are useful with text in multicolumn formats,
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
501 and for changing text into or out of such formats.
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
502
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
503 @cindex mark rectangle
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
504 When you must specify a rectangle for a command to work on, you do it
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
505 by putting the mark at one corner and point at the opposite corner. The
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
506 rectangle thus specified is called the @dfn{region-rectangle} because
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
507 you control it in much the same way as the region is controlled. But
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
508 remember that a given combination of point and mark values can be
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
509 interpreted either as a region or as a rectangle, depending on the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
510 command that uses them.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
511
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
512 If point and the mark are in the same column, the rectangle they
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
513 delimit is empty. If they are in the same line, the rectangle is one
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
514 line high. This asymmetry between lines and columns comes about
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
515 because point (and likewise the mark) is between two columns, but within
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
516 a line.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
517
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
518 @table @kbd
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
519 @item C-x r k
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
520 Kill the text of the region-rectangle, saving its contents as the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
521 ``last killed rectangle'' (@code{kill-rectangle}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
522 @item C-x r d
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
523 Delete the text of the region-rectangle (@code{delete-rectangle}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
524 @item C-x r y
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
525 Yank the last killed rectangle with its upper left corner at point
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
526 (@code{yank-rectangle}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
527 @item C-x r o
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
528 Insert blank space to fill the space of the region-rectangle
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
529 (@code{open-rectangle}). This pushes the previous contents of the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
530 region-rectangle rightward.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
531 @item C-x r c
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
532 Clear the region-rectangle by replacing all of its contents with spaces
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
533 (@code{clear-rectangle}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
534 @item M-x delete-whitespace-rectangle
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
535 Delete whitespace in each of the lines on the specified rectangle,
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
536 starting from the left edge column of the rectangle.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
537 @item C-x r t @var{string} @key{RET}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
538 Replace rectangle contents with @var{string} on each line
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
539 (@code{string-rectangle}).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
540 @item M-x string-insert-rectangle @key{RET} @var{string} @key{RET}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
541 Insert @var{string} on each line of the rectangle.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
542 @end table
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
543
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
544 The rectangle operations fall into two classes: commands for
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
545 deleting and inserting rectangles, and commands for blank rectangles.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
546
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
547 @kindex C-x r k
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
548 @kindex C-x r d
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
549 @findex kill-rectangle
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
550 @findex delete-rectangle
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
551 There are two ways to get rid of the text in a rectangle: you can
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
552 discard the text (delete it) or save it as the ``last killed''
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
553 rectangle. The commands for these two ways are @kbd{C-x r d}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
554 (@code{delete-rectangle}) and @kbd{C-x r k} (@code{kill-rectangle}). In
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
555 either case, the portion of each line that falls inside the rectangle's
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
556 boundaries is deleted, causing any following text on the line to
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
557 move left into the gap.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
558
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
559 Note that ``killing'' a rectangle is not killing in the usual sense; the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
560 rectangle is not stored in the kill ring, but in a special place that
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
561 can only record the most recent rectangle killed. This is because yanking
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
562 a rectangle is so different from yanking linear text that different yank
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
563 commands have to be used. It is hard to define yank-popping for rectangles,
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
564 so we do not try.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
565
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
566 @kindex C-x r y
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
567 @findex yank-rectangle
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
568 To yank the last killed rectangle, type @kbd{C-x r y}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
569 (@code{yank-rectangle}). Yanking a rectangle is the opposite of killing
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
570 one. Point specifies where to put the rectangle's upper left corner.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
571 The rectangle's first line is inserted there, the rectangle's second
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
572 line is inserted at the same horizontal position, but one line
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
573 vertically down, and so on. The number of lines affected is determined
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
574 by the height of the saved rectangle.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
575
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
576 You can convert single-column lists into double-column lists using
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
577 rectangle killing and yanking; kill the second half of the list as a
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
578 rectangle and then yank it beside the first line of the list.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
579 @xref{Two-Column}, for another way to edit multi-column text.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
580
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
581 You can also copy rectangles into and out of registers with @kbd{C-x r
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
582 r @var{r}} and @kbd{C-x r i @var{r}}. @xref{RegRect,,Rectangle
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
583 Registers}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
584
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
585 @kindex C-x r o
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
586 @findex open-rectangle
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
587 @kindex C-x r c
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
588 @findex clear-rectangle
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
589 There are two commands you can use for making blank rectangles:
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
590 @kbd{C-x r c} (@code{clear-rectangle}) which blanks out existing text,
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
591 and @kbd{C-x r o} (@code{open-rectangle}) which inserts a blank
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
592 rectangle. Clearing a rectangle is equivalent to deleting it and then
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
593 inserting a blank rectangle of the same size.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
594
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
595 @findex delete-whitespace-rectangle
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
596 The command @kbd{M-x delete-whitespace-rectangle} deletes horizontal
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
597 whitespace starting from a particular column. This applies to each of
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
598 the lines in the rectangle, and the column is specified by the left
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
599 edge of the rectangle. The right edge of the rectangle does not make
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
600 any difference to this command.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
601
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
602 @kindex C-x r t
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
603 @findex string-rectangle
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
604 The command @kbd{C-x r t} (@code{string-rectangle}) replaces the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
605 contents of a region-rectangle with a string on each line. The
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
606 string's width need not be the same as the width of the rectangle. If
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
607 the string's width is less, the text after the rectangle shifts left;
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
608 if the string is wider than the rectangle, the text after the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
609 rectangle shifts right.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
610
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
611 @findex string-insert-rectangle
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
612 The command @kbd{M-x string-insert-rectangle} is similar to
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
613 @code{string-rectangle}, but inserts the string on each line,
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
614 shifting the original text to the right.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
615
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
616 @node CUA Bindings, Registers, Rectangles, Top
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
617 @section CUA Bindings
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
618 @findex cua-mode
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
619 @vindex cua-mode
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
620 @cindex CUA key bindings
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
621 @vindex cua-enable-cua-keys
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
622 The command @kbd{M-x cua-mode} sets up key bindings that are
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
623 compatible with the Common User Access (CUA) system used in many other
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
624 applications. @kbd{C-x} means cut (kill), @kbd{C-c} copy, @kbd{C-v}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
625 paste (yank), and @kbd{C-z} undo. Standard Emacs commands like
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
626 @kbd{C-x C-c} still work, because @kbd{C-x} and @kbd{C-c} only take
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
627 effect when the mark is active (and the region is highlighted).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
628 However, if you don't want to override these bindings in Emacs at all,
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
629 set @code{cua-enable-cua-keys} to @code{nil}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
630
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
631 To enter an Emacs command like @kbd{C-x C-f} while the mark is
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
632 active, use one of the following methods: either hold @kbd{Shift}
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
633 together with the prefix key, e.g. @kbd{S-C-x C-f}, or quickly type
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
634 the prefix key twice, e.g. @kbd{C-x C-x C-f}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
635
97504
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
636 In CUA mode, typed text replaces the active region as in
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
637 Delete-Selection mode (@pxref{Mouse Commands}).
2366710ba233 (Killing): Copyedit. Define read-only text.
Chong Yidong <cyd@stupidchicken.com>
parents: 94777
diff changeset
638
84248
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
639 @cindex rectangle highlighting
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
640 CUA mode provides enhanced rectangle support with visible
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
641 rectangle highlighting. Use @kbd{C-RET} to start a rectangle,
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
642 extend it using the movement commands, and cut or copy it using
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
643 @kbd{C-x} or @kbd{C-c}. @kbd{RET} moves the cursor to the next
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
644 (clockwise) corner of the rectangle, so you can easily expand it in
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
645 any direction. Normal text you type is inserted to the left or right
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
646 of each line in the rectangle (on the same side as the cursor).
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
647
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
648 With CUA you can easily copy text and rectangles into and out of
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
649 registers by providing a one-digit numeric prefix to the kill, copy,
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
650 and yank commands, e.g. @kbd{C-1 C-c} copies the region into register
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
651 @code{1}, and @kbd{C-2 C-v} yanks the contents of register @code{2}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
652
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
653 @cindex global mark
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
654 CUA mode also has a global mark feature which allows easy moving and
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
655 copying of text between buffers. Use @kbd{C-S-SPC} to toggle the
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
656 global mark on and off. When the global mark is on, all text that you
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
657 kill or copy is automatically inserted at the global mark, and text
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
658 you type is inserted at the global mark rather than at the current
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
659 position.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
660
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
661 For example, to copy words from various buffers into a word list in
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
662 a given buffer, set the global mark in the target buffer, then
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
663 navigate to each of the words you want in the list, mark it (e.g. with
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
664 @kbd{S-M-f}), copy it to the list with @kbd{C-c} or @kbd{M-w}, and
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
665 insert a newline after the word in the target list by pressing
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
666 @key{RET}.
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
667
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
668 @ifnottex
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
669 @lowersections
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
670 @end ifnottex
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
671
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
672 @ignore
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
673 arch-tag: d8da8f96-0928-449a-816e-ff2d3497866c
7c95711a3c68 Move here from ../../man
Glenn Morris <rgm@gnu.org>
parents:
diff changeset
674 @end ignore