annotate man/regs.texi @ 62683:caf3db99145f

Write about mouse-face on mode-line and header-line.
author Masatake YAMATO <jet@gyve.org>
date Tue, 24 May 2005 17:12:50 +0000
parents 13d3a7544d29
children 3723093a21fd 3ebd9bdb4fe5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
1 @c This is part of the Emacs manual.
Dave Love <fx@gnu.org>
parents:
diff changeset
2 @c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
Dave Love <fx@gnu.org>
parents:
diff changeset
3 @c See file emacs.texi for copying conditions.
Dave Love <fx@gnu.org>
parents:
diff changeset
4 @node Registers, Display, Rectangles, Top
Dave Love <fx@gnu.org>
parents:
diff changeset
5 @chapter Registers
Dave Love <fx@gnu.org>
parents:
diff changeset
6 @cindex registers
Dave Love <fx@gnu.org>
parents:
diff changeset
7
37313
6cd5aaf1a361 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 25829
diff changeset
8 Emacs @dfn{registers} are compartments where you can save text,
6cd5aaf1a361 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 25829
diff changeset
9 rectangles, positions, and other things for later use. Once you save
6cd5aaf1a361 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 25829
diff changeset
10 text or a rectangle in a register, you can copy it into the buffer
38129
2db5f7aaa215 Minor corrections.
Richard M. Stallman <rms@gnu.org>
parents: 38048
diff changeset
11 once, or many times; you can move point to a position saved in a
2db5f7aaa215 Minor corrections.
Richard M. Stallman <rms@gnu.org>
parents: 38048
diff changeset
12 register once, or many times.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
13
Dave Love <fx@gnu.org>
parents:
diff changeset
14 @findex view-register
59952
13d3a7544d29 (Registers): Registers can hold numbers, too.
Richard M. Stallman <rms@gnu.org>
parents: 56655
diff changeset
15 Each register has a name, which consists of a single character. A
13d3a7544d29 (Registers): Registers can hold numbers, too.
Richard M. Stallman <rms@gnu.org>
parents: 56655
diff changeset
16 register can store a number, a piece of text, a rectangle, a position,
13d3a7544d29 (Registers): Registers can hold numbers, too.
Richard M. Stallman <rms@gnu.org>
parents: 56655
diff changeset
17 a window configuration, or a file name, but only one thing at any
13d3a7544d29 (Registers): Registers can hold numbers, too.
Richard M. Stallman <rms@gnu.org>
parents: 56655
diff changeset
18 given time. Whatever you store in a register remains there until you
13d3a7544d29 (Registers): Registers can hold numbers, too.
Richard M. Stallman <rms@gnu.org>
parents: 56655
diff changeset
19 store something else in that register. To see what a register @var{r}
13d3a7544d29 (Registers): Registers can hold numbers, too.
Richard M. Stallman <rms@gnu.org>
parents: 56655
diff changeset
20 contains, use @kbd{M-x view-register}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
21
Dave Love <fx@gnu.org>
parents:
diff changeset
22 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
23 @item M-x view-register @key{RET} @var{r}
Dave Love <fx@gnu.org>
parents:
diff changeset
24 Display a description of what register @var{r} contains.
Dave Love <fx@gnu.org>
parents:
diff changeset
25 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
26
Dave Love <fx@gnu.org>
parents:
diff changeset
27 @menu
Dave Love <fx@gnu.org>
parents:
diff changeset
28 * Position: RegPos. Saving positions in registers.
Dave Love <fx@gnu.org>
parents:
diff changeset
29 * Text: RegText. Saving text in registers.
Dave Love <fx@gnu.org>
parents:
diff changeset
30 * Rectangle: RegRect. Saving rectangles in registers.
Dave Love <fx@gnu.org>
parents:
diff changeset
31 * Configurations: RegConfig. Saving window configurations in registers.
56655
3a8fa7f090da (RegNumbers): Mention `C-x r i' binding for `insert-register', instead
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
32 * Numbers: RegNumbers. Numbers in registers.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
33 * Files: RegFiles. File names in registers.
Dave Love <fx@gnu.org>
parents:
diff changeset
34 * Bookmarks:: Bookmarks are like registers, but persistent.
Dave Love <fx@gnu.org>
parents:
diff changeset
35 @end menu
Dave Love <fx@gnu.org>
parents:
diff changeset
36
Dave Love <fx@gnu.org>
parents:
diff changeset
37 @node RegPos
Dave Love <fx@gnu.org>
parents:
diff changeset
38 @section Saving Positions in Registers
40267
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
39 @cindex saving position in a register
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
40
Dave Love <fx@gnu.org>
parents:
diff changeset
41 Saving a position records a place in a buffer so that you can move
Dave Love <fx@gnu.org>
parents:
diff changeset
42 back there later. Moving to a saved position switches to that buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
43 and moves point to that place in it.
Dave Love <fx@gnu.org>
parents:
diff changeset
44
Dave Love <fx@gnu.org>
parents:
diff changeset
45 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
46 @item C-x r @key{SPC} @var{r}
Dave Love <fx@gnu.org>
parents:
diff changeset
47 Save position of point in register @var{r} (@code{point-to-register}).
Dave Love <fx@gnu.org>
parents:
diff changeset
48 @item C-x r j @var{r}
Dave Love <fx@gnu.org>
parents:
diff changeset
49 Jump to the position saved in register @var{r} (@code{jump-to-register}).
Dave Love <fx@gnu.org>
parents:
diff changeset
50 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
51
Dave Love <fx@gnu.org>
parents:
diff changeset
52 @kindex C-x r SPC
Dave Love <fx@gnu.org>
parents:
diff changeset
53 @findex point-to-register
Dave Love <fx@gnu.org>
parents:
diff changeset
54 To save the current position of point in a register, choose a name
Dave Love <fx@gnu.org>
parents:
diff changeset
55 @var{r} and type @kbd{C-x r @key{SPC} @var{r}}. The register @var{r}
Dave Love <fx@gnu.org>
parents:
diff changeset
56 retains the position thus saved until you store something else in that
Dave Love <fx@gnu.org>
parents:
diff changeset
57 register.
Dave Love <fx@gnu.org>
parents:
diff changeset
58
Dave Love <fx@gnu.org>
parents:
diff changeset
59 @kindex C-x r j
Dave Love <fx@gnu.org>
parents:
diff changeset
60 @findex jump-to-register
Dave Love <fx@gnu.org>
parents:
diff changeset
61 The command @kbd{C-x r j @var{r}} moves point to the position recorded
Dave Love <fx@gnu.org>
parents:
diff changeset
62 in register @var{r}. The register is not affected; it continues to
38129
2db5f7aaa215 Minor corrections.
Richard M. Stallman <rms@gnu.org>
parents: 38048
diff changeset
63 hold the same position. You can jump to the saved position any number
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
64 of times.
Dave Love <fx@gnu.org>
parents:
diff changeset
65
Dave Love <fx@gnu.org>
parents:
diff changeset
66 If you use @kbd{C-x r j} to go to a saved position, but the buffer it
Dave Love <fx@gnu.org>
parents:
diff changeset
67 was saved from has been killed, @kbd{C-x r j} tries to create the buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
68 again by visiting the same file. Of course, this works only for buffers
Dave Love <fx@gnu.org>
parents:
diff changeset
69 that were visiting files.
Dave Love <fx@gnu.org>
parents:
diff changeset
70
Dave Love <fx@gnu.org>
parents:
diff changeset
71 @node RegText
Dave Love <fx@gnu.org>
parents:
diff changeset
72 @section Saving Text in Registers
40267
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
73 @cindex saving text in a register
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
74
Dave Love <fx@gnu.org>
parents:
diff changeset
75 When you want to insert a copy of the same piece of text several
Dave Love <fx@gnu.org>
parents:
diff changeset
76 times, it may be inconvenient to yank it from the kill ring, since each
Dave Love <fx@gnu.org>
parents:
diff changeset
77 subsequent kill moves that entry further down the ring. An alternative
Dave Love <fx@gnu.org>
parents:
diff changeset
78 is to store the text in a register and later retrieve it.
Dave Love <fx@gnu.org>
parents:
diff changeset
79
Dave Love <fx@gnu.org>
parents:
diff changeset
80 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
81 @item C-x r s @var{r}
Dave Love <fx@gnu.org>
parents:
diff changeset
82 Copy region into register @var{r} (@code{copy-to-register}).
Dave Love <fx@gnu.org>
parents:
diff changeset
83 @item C-x r i @var{r}
Dave Love <fx@gnu.org>
parents:
diff changeset
84 Insert text from register @var{r} (@code{insert-register}).
40267
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
85 @item M-x append-to-register @key{RET} @var{r}
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
86 Append region to text in register @var{r}.
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
87 @item M-x prepend-to-register @key{RET} @var{r}
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
88 Prepend region to text in register @var{r}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
89 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
90
Dave Love <fx@gnu.org>
parents:
diff changeset
91 @kindex C-x r s
Dave Love <fx@gnu.org>
parents:
diff changeset
92 @kindex C-x r i
Dave Love <fx@gnu.org>
parents:
diff changeset
93 @findex copy-to-register
Dave Love <fx@gnu.org>
parents:
diff changeset
94 @findex insert-register
38129
2db5f7aaa215 Minor corrections.
Richard M. Stallman <rms@gnu.org>
parents: 38048
diff changeset
95 @kbd{C-x r s @var{r}} stores a copy of the text of the region into
2db5f7aaa215 Minor corrections.
Richard M. Stallman <rms@gnu.org>
parents: 38048
diff changeset
96 the register named @var{r}. @kbd{C-u C-x r s @var{r}}, the same
2db5f7aaa215 Minor corrections.
Richard M. Stallman <rms@gnu.org>
parents: 38048
diff changeset
97 command with a numeric argument, deletes the text from the buffer as
38954
5c282c7df1cf Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 38129
diff changeset
98 well; you can think of this as ``moving'' the region text into the register.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
99
40267
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
100 @findex append-to-register
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
101 @findex prepend-to-register
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
102 @kbd{M-x append-to-register @key{RET} @var{r}} appends the copy of
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
103 the text in the region to the text already stored in the register
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
104 named @var{r}. If invoked with a numeric argument, it deletes the
40415
ac85b3ae7a59 (RegText): Fix the wording in the last change. From Richard Stallman.
Eli Zaretskii <eliz@gnu.org>
parents: 40267
diff changeset
105 region after appending it to the register. The command
ac85b3ae7a59 (RegText): Fix the wording in the last change. From Richard Stallman.
Eli Zaretskii <eliz@gnu.org>
parents: 40267
diff changeset
106 @code{prepend-to-register} is similar, except that it @emph{prepends}
ac85b3ae7a59 (RegText): Fix the wording in the last change. From Richard Stallman.
Eli Zaretskii <eliz@gnu.org>
parents: 40267
diff changeset
107 the region text to the text in the register, rather than
ac85b3ae7a59 (RegText): Fix the wording in the last change. From Richard Stallman.
Eli Zaretskii <eliz@gnu.org>
parents: 40267
diff changeset
108 @emph{appending} it.
40267
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
109
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
110 @kbd{C-x r i @var{r}} inserts in the buffer the text from register
Dave Love <fx@gnu.org>
parents:
diff changeset
111 @var{r}. Normally it leaves point before the text and places the mark
Dave Love <fx@gnu.org>
parents:
diff changeset
112 after, but with a numeric argument (@kbd{C-u}) it puts point after the
Dave Love <fx@gnu.org>
parents:
diff changeset
113 text and the mark before.
Dave Love <fx@gnu.org>
parents:
diff changeset
114
Dave Love <fx@gnu.org>
parents:
diff changeset
115 @node RegRect
Dave Love <fx@gnu.org>
parents:
diff changeset
116 @section Saving Rectangles in Registers
40267
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
117 @cindex saving rectangle in a register
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
118
Dave Love <fx@gnu.org>
parents:
diff changeset
119 A register can contain a rectangle instead of linear text. The
Dave Love <fx@gnu.org>
parents:
diff changeset
120 rectangle is represented as a list of strings. @xref{Rectangles}, for
Dave Love <fx@gnu.org>
parents:
diff changeset
121 basic information on how to specify a rectangle in the buffer.
Dave Love <fx@gnu.org>
parents:
diff changeset
122
Dave Love <fx@gnu.org>
parents:
diff changeset
123 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
124 @findex copy-rectangle-to-register
Dave Love <fx@gnu.org>
parents:
diff changeset
125 @kindex C-x r r
Dave Love <fx@gnu.org>
parents:
diff changeset
126 @item C-x r r @var{r}
Dave Love <fx@gnu.org>
parents:
diff changeset
127 Copy the region-rectangle into register @var{r}
Dave Love <fx@gnu.org>
parents:
diff changeset
128 (@code{copy-rectangle-to-register}). With numeric argument, delete it as
Dave Love <fx@gnu.org>
parents:
diff changeset
129 well.
Dave Love <fx@gnu.org>
parents:
diff changeset
130 @item C-x r i @var{r}
Dave Love <fx@gnu.org>
parents:
diff changeset
131 Insert the rectangle stored in register @var{r} (if it contains a
Dave Love <fx@gnu.org>
parents:
diff changeset
132 rectangle) (@code{insert-register}).
Dave Love <fx@gnu.org>
parents:
diff changeset
133 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
134
Dave Love <fx@gnu.org>
parents:
diff changeset
135 The @kbd{C-x r i @var{r}} command inserts a text string if the
Dave Love <fx@gnu.org>
parents:
diff changeset
136 register contains one, and inserts a rectangle if the register contains
Dave Love <fx@gnu.org>
parents:
diff changeset
137 one.
Dave Love <fx@gnu.org>
parents:
diff changeset
138
Dave Love <fx@gnu.org>
parents:
diff changeset
139 See also the command @code{sort-columns}, which you can think of
Dave Love <fx@gnu.org>
parents:
diff changeset
140 as sorting a rectangle. @xref{Sorting}.
Dave Love <fx@gnu.org>
parents:
diff changeset
141
Dave Love <fx@gnu.org>
parents:
diff changeset
142 @node RegConfig
Dave Love <fx@gnu.org>
parents:
diff changeset
143 @section Saving Window Configurations in Registers
40267
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
144 @cindex saving window configuration in a register
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
145
Dave Love <fx@gnu.org>
parents:
diff changeset
146 @findex window-configuration-to-register
Dave Love <fx@gnu.org>
parents:
diff changeset
147 @findex frame-configuration-to-register
Dave Love <fx@gnu.org>
parents:
diff changeset
148 @kindex C-x r w
Dave Love <fx@gnu.org>
parents:
diff changeset
149 @kindex C-x r f
Dave Love <fx@gnu.org>
parents:
diff changeset
150 You can save the window configuration of the selected frame in a
Dave Love <fx@gnu.org>
parents:
diff changeset
151 register, or even the configuration of all windows in all frames, and
Dave Love <fx@gnu.org>
parents:
diff changeset
152 restore the configuration later.
Dave Love <fx@gnu.org>
parents:
diff changeset
153
Dave Love <fx@gnu.org>
parents:
diff changeset
154 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
155 @item C-x r w @var{r}
Dave Love <fx@gnu.org>
parents:
diff changeset
156 Save the state of the selected frame's windows in register @var{r}
Dave Love <fx@gnu.org>
parents:
diff changeset
157 (@code{window-configuration-to-register}).
Dave Love <fx@gnu.org>
parents:
diff changeset
158 @item C-x r f @var{r}
Dave Love <fx@gnu.org>
parents:
diff changeset
159 Save the state of all frames, including all their windows, in register
Dave Love <fx@gnu.org>
parents:
diff changeset
160 @var{r} (@code{frame-configuration-to-register}).
Dave Love <fx@gnu.org>
parents:
diff changeset
161 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
162
Dave Love <fx@gnu.org>
parents:
diff changeset
163 Use @kbd{C-x r j @var{r}} to restore a window or frame configuration.
Dave Love <fx@gnu.org>
parents:
diff changeset
164 This is the same command used to restore a cursor position. When you
Dave Love <fx@gnu.org>
parents:
diff changeset
165 restore a frame configuration, any existing frames not included in the
Dave Love <fx@gnu.org>
parents:
diff changeset
166 configuration become invisible. If you wish to delete these frames
Dave Love <fx@gnu.org>
parents:
diff changeset
167 instead, use @kbd{C-u C-x r j @var{r}}.
Dave Love <fx@gnu.org>
parents:
diff changeset
168
Dave Love <fx@gnu.org>
parents:
diff changeset
169 @node RegNumbers
Dave Love <fx@gnu.org>
parents:
diff changeset
170 @section Keeping Numbers in Registers
40267
dca37162945a (RegText): Document append-to-register and prepend-to-register.
Eli Zaretskii <eliz@gnu.org>
parents: 38954
diff changeset
171 @cindex saving number in a register
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
172
Dave Love <fx@gnu.org>
parents:
diff changeset
173 There are commands to store a number in a register, to insert
Dave Love <fx@gnu.org>
parents:
diff changeset
174 the number in the buffer in decimal, and to increment it. These commands
Dave Love <fx@gnu.org>
parents:
diff changeset
175 can be useful in keyboard macros (@pxref{Keyboard Macros}).
Dave Love <fx@gnu.org>
parents:
diff changeset
176
Dave Love <fx@gnu.org>
parents:
diff changeset
177 @table @kbd
37313
6cd5aaf1a361 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 25829
diff changeset
178 @item C-u @var{number} C-x r n @var{r}
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
179 @kindex C-x r n
Dave Love <fx@gnu.org>
parents:
diff changeset
180 @findex number-to-register
37313
6cd5aaf1a361 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 25829
diff changeset
181 Store @var{number} into register @var{r} (@code{number-to-register}).
6cd5aaf1a361 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 25829
diff changeset
182 @item C-u @var{number} C-x r + @var{r}
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
183 @kindex C-x r +
Dave Love <fx@gnu.org>
parents:
diff changeset
184 @findex increment-register
37313
6cd5aaf1a361 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 25829
diff changeset
185 Increment the number in register @var{r} by @var{number}
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
186 (@code{increment-register}).
56655
3a8fa7f090da (RegNumbers): Mention `C-x r i' binding for `insert-register', instead
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
187 @item C-x r i @var{r}
37313
6cd5aaf1a361 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 25829
diff changeset
188 Insert the number from register @var{r} into the buffer.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
189 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
190
56655
3a8fa7f090da (RegNumbers): Mention `C-x r i' binding for `insert-register', instead
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
191 @kbd{C-x r i} is the same command used to insert any other sort of
37313
6cd5aaf1a361 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 25829
diff changeset
192 register contents into the buffer. @kbd{C-x r +} with no numeric
6cd5aaf1a361 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 25829
diff changeset
193 argument increments the register value by 1; @kbd{C-x r n} with no
6cd5aaf1a361 Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 25829
diff changeset
194 numeric argument stores zero in the register.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
195
Dave Love <fx@gnu.org>
parents:
diff changeset
196 @node RegFiles
Dave Love <fx@gnu.org>
parents:
diff changeset
197 @section Keeping File Names in Registers
48700
df6767370b43 Fix typo.
Pavel Janík <Pavel@Janik.cz>
parents: 40415
diff changeset
198 @cindex saving file name in a register
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
199
Dave Love <fx@gnu.org>
parents:
diff changeset
200 If you visit certain file names frequently, you can visit them more
Dave Love <fx@gnu.org>
parents:
diff changeset
201 conveniently if you put their names in registers. Here's the Lisp code
Dave Love <fx@gnu.org>
parents:
diff changeset
202 used to put a file name in a register:
Dave Love <fx@gnu.org>
parents:
diff changeset
203
Dave Love <fx@gnu.org>
parents:
diff changeset
204 @smallexample
Dave Love <fx@gnu.org>
parents:
diff changeset
205 (set-register ?@var{r} '(file . @var{name}))
Dave Love <fx@gnu.org>
parents:
diff changeset
206 @end smallexample
Dave Love <fx@gnu.org>
parents:
diff changeset
207
Dave Love <fx@gnu.org>
parents:
diff changeset
208 @need 3000
Dave Love <fx@gnu.org>
parents:
diff changeset
209 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
210 For example,
Dave Love <fx@gnu.org>
parents:
diff changeset
211
Dave Love <fx@gnu.org>
parents:
diff changeset
212 @smallexample
Dave Love <fx@gnu.org>
parents:
diff changeset
213 (set-register ?z '(file . "/gd/gnu/emacs/19.0/src/ChangeLog"))
Dave Love <fx@gnu.org>
parents:
diff changeset
214 @end smallexample
Dave Love <fx@gnu.org>
parents:
diff changeset
215
Dave Love <fx@gnu.org>
parents:
diff changeset
216 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
217 puts the file name shown in register @samp{z}.
Dave Love <fx@gnu.org>
parents:
diff changeset
218
Dave Love <fx@gnu.org>
parents:
diff changeset
219 To visit the file whose name is in register @var{r}, type @kbd{C-x r j
Dave Love <fx@gnu.org>
parents:
diff changeset
220 @var{r}}. (This is the same command used to jump to a position or
Dave Love <fx@gnu.org>
parents:
diff changeset
221 restore a frame configuration.)
Dave Love <fx@gnu.org>
parents:
diff changeset
222
Dave Love <fx@gnu.org>
parents:
diff changeset
223 @node Bookmarks
Dave Love <fx@gnu.org>
parents:
diff changeset
224 @section Bookmarks
Dave Love <fx@gnu.org>
parents:
diff changeset
225 @cindex bookmarks
Dave Love <fx@gnu.org>
parents:
diff changeset
226
Dave Love <fx@gnu.org>
parents:
diff changeset
227 @dfn{Bookmarks} are somewhat like registers in that they record
Dave Love <fx@gnu.org>
parents:
diff changeset
228 positions you can jump to. Unlike registers, they have long names, and
Dave Love <fx@gnu.org>
parents:
diff changeset
229 they persist automatically from one Emacs session to the next. The
Dave Love <fx@gnu.org>
parents:
diff changeset
230 prototypical use of bookmarks is to record ``where you were reading'' in
Dave Love <fx@gnu.org>
parents:
diff changeset
231 various files.
Dave Love <fx@gnu.org>
parents:
diff changeset
232
Dave Love <fx@gnu.org>
parents:
diff changeset
233 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
234 @item C-x r m @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
235 Set the bookmark for the visited file, at point.
Dave Love <fx@gnu.org>
parents:
diff changeset
236
Dave Love <fx@gnu.org>
parents:
diff changeset
237 @item C-x r m @var{bookmark} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
238 @findex bookmark-set
Dave Love <fx@gnu.org>
parents:
diff changeset
239 Set the bookmark named @var{bookmark} at point (@code{bookmark-set}).
Dave Love <fx@gnu.org>
parents:
diff changeset
240
Dave Love <fx@gnu.org>
parents:
diff changeset
241 @item C-x r b @var{bookmark} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
242 @findex bookmark-jump
Dave Love <fx@gnu.org>
parents:
diff changeset
243 Jump to the bookmark named @var{bookmark} (@code{bookmark-jump}).
Dave Love <fx@gnu.org>
parents:
diff changeset
244
Dave Love <fx@gnu.org>
parents:
diff changeset
245 @item C-x r l
Dave Love <fx@gnu.org>
parents:
diff changeset
246 @findex list-bookmarks
Dave Love <fx@gnu.org>
parents:
diff changeset
247 List all bookmarks (@code{list-bookmarks}).
Dave Love <fx@gnu.org>
parents:
diff changeset
248
Dave Love <fx@gnu.org>
parents:
diff changeset
249 @item M-x bookmark-save
Dave Love <fx@gnu.org>
parents:
diff changeset
250 @findex bookmark-save
Dave Love <fx@gnu.org>
parents:
diff changeset
251 Save all the current bookmark values in the default bookmark file.
Dave Love <fx@gnu.org>
parents:
diff changeset
252 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
253
Dave Love <fx@gnu.org>
parents:
diff changeset
254 @kindex C-x r m
Dave Love <fx@gnu.org>
parents:
diff changeset
255 @findex bookmark-set
Dave Love <fx@gnu.org>
parents:
diff changeset
256 @kindex C-x r b
Dave Love <fx@gnu.org>
parents:
diff changeset
257 @findex bookmark-jump
Dave Love <fx@gnu.org>
parents:
diff changeset
258 The prototypical use for bookmarks is to record one current position
Dave Love <fx@gnu.org>
parents:
diff changeset
259 in each of several files. So the command @kbd{C-x r m}, which sets a
Dave Love <fx@gnu.org>
parents:
diff changeset
260 bookmark, uses the visited file name as the default for the bookmark
Dave Love <fx@gnu.org>
parents:
diff changeset
261 name. If you name each bookmark after the file it points to, then you
Dave Love <fx@gnu.org>
parents:
diff changeset
262 can conveniently revisit any of those files with @kbd{C-x r b}, and move
Dave Love <fx@gnu.org>
parents:
diff changeset
263 to the position of the bookmark at the same time.
Dave Love <fx@gnu.org>
parents:
diff changeset
264
Dave Love <fx@gnu.org>
parents:
diff changeset
265 @kindex C-x r l
Dave Love <fx@gnu.org>
parents:
diff changeset
266 To display a list of all your bookmarks in a separate buffer, type
Dave Love <fx@gnu.org>
parents:
diff changeset
267 @kbd{C-x r l} (@code{list-bookmarks}). If you switch to that buffer,
Dave Love <fx@gnu.org>
parents:
diff changeset
268 you can use it to edit your bookmark definitions or annotate the
38954
5c282c7df1cf Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 38129
diff changeset
269 bookmarks. Type @kbd{C-h m} in the bookmark buffer for more
5c282c7df1cf Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 38129
diff changeset
270 information about its special editing commands.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
271
Dave Love <fx@gnu.org>
parents:
diff changeset
272 When you kill Emacs, Emacs offers to save your bookmark values in your
Dave Love <fx@gnu.org>
parents:
diff changeset
273 default bookmark file, @file{~/.emacs.bmk}, if you have changed any
Dave Love <fx@gnu.org>
parents:
diff changeset
274 bookmark values. You can also save the bookmarks at any time with the
Dave Love <fx@gnu.org>
parents:
diff changeset
275 @kbd{M-x bookmark-save} command. The bookmark commands load your
Dave Love <fx@gnu.org>
parents:
diff changeset
276 default bookmark file automatically. This saving and loading is how
Dave Love <fx@gnu.org>
parents:
diff changeset
277 bookmarks persist from one Emacs session to the next.
Dave Love <fx@gnu.org>
parents:
diff changeset
278
Dave Love <fx@gnu.org>
parents:
diff changeset
279 @vindex bookmark-save-flag
Dave Love <fx@gnu.org>
parents:
diff changeset
280 If you set the variable @code{bookmark-save-flag} to 1, then each
Dave Love <fx@gnu.org>
parents:
diff changeset
281 command that sets a bookmark will also save your bookmarks; this way,
Dave Love <fx@gnu.org>
parents:
diff changeset
282 you don't lose any bookmark values even if Emacs crashes. (The value,
Dave Love <fx@gnu.org>
parents:
diff changeset
283 if a number, says how many bookmark modifications should go by between
Dave Love <fx@gnu.org>
parents:
diff changeset
284 saving.)
Dave Love <fx@gnu.org>
parents:
diff changeset
285
Dave Love <fx@gnu.org>
parents:
diff changeset
286 @vindex bookmark-search-size
Dave Love <fx@gnu.org>
parents:
diff changeset
287 Bookmark position values are saved with surrounding context, so that
Dave Love <fx@gnu.org>
parents:
diff changeset
288 @code{bookmark-jump} can find the proper position even if the file is
Dave Love <fx@gnu.org>
parents:
diff changeset
289 modified slightly. The variable @code{bookmark-search-size} says how
38048
bd45e6c57fba Proofreading fixes from Danny Colascione <qtmstr@optonline.net>.
Eli Zaretskii <eliz@gnu.org>
parents: 37313
diff changeset
290 many characters of context to record on each side of the bookmark's
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
291 position.
Dave Love <fx@gnu.org>
parents:
diff changeset
292
Dave Love <fx@gnu.org>
parents:
diff changeset
293 Here are some additional commands for working with bookmarks:
Dave Love <fx@gnu.org>
parents:
diff changeset
294
Dave Love <fx@gnu.org>
parents:
diff changeset
295 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
296 @item M-x bookmark-load @key{RET} @var{filename} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
297 @findex bookmark-load
Dave Love <fx@gnu.org>
parents:
diff changeset
298 Load a file named @var{filename} that contains a list of bookmark
Dave Love <fx@gnu.org>
parents:
diff changeset
299 values. You can use this command, as well as @code{bookmark-write}, to
Dave Love <fx@gnu.org>
parents:
diff changeset
300 work with other files of bookmark values in addition to your default
Dave Love <fx@gnu.org>
parents:
diff changeset
301 bookmark file.
Dave Love <fx@gnu.org>
parents:
diff changeset
302
Dave Love <fx@gnu.org>
parents:
diff changeset
303 @item M-x bookmark-write @key{RET} @var{filename} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
304 @findex bookmark-write
Dave Love <fx@gnu.org>
parents:
diff changeset
305 Save all the current bookmark values in the file @var{filename}.
Dave Love <fx@gnu.org>
parents:
diff changeset
306
Dave Love <fx@gnu.org>
parents:
diff changeset
307 @item M-x bookmark-delete @key{RET} @var{bookmark} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
308 @findex bookmark-delete
Dave Love <fx@gnu.org>
parents:
diff changeset
309 Delete the bookmark named @var{bookmark}.
Dave Love <fx@gnu.org>
parents:
diff changeset
310
Dave Love <fx@gnu.org>
parents:
diff changeset
311 @item M-x bookmark-insert-location @key{RET} @var{bookmark} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
312 @findex bookmark-insert-location
Dave Love <fx@gnu.org>
parents:
diff changeset
313 Insert in the buffer the name of the file that bookmark @var{bookmark}
Dave Love <fx@gnu.org>
parents:
diff changeset
314 points to.
Dave Love <fx@gnu.org>
parents:
diff changeset
315
Dave Love <fx@gnu.org>
parents:
diff changeset
316 @item M-x bookmark-insert @key{RET} @var{bookmark} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
317 @findex bookmark-insert
Dave Love <fx@gnu.org>
parents:
diff changeset
318 Insert in the buffer the @emph{contents} of the file that bookmark
Dave Love <fx@gnu.org>
parents:
diff changeset
319 @var{bookmark} points to.
Dave Love <fx@gnu.org>
parents:
diff changeset
320 @end table
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 48700
diff changeset
321
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 48700
diff changeset
322 @ignore
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 48700
diff changeset
323 arch-tag: b00af991-ebc3-4b3a-8e82-a3ac81ff2e64
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 48700
diff changeset
324 @end ignore