1 @node Registers, Display, Rectangles, Top
5 SXEmacs @dfn{registers} are places in which you can save text or
6 positions for later use. Once you save text or a rectangle in a
7 register, you can copy it into the buffer once or many times; a position
8 saved in a register is used by moving point to that position.
9 Rectangles can also be copied into and out of registers
13 Each register has a name which is a single character. A register can
14 store a piece of text, a rectangle, a position, a window configuration,
15 or a file name, but only one thing at any given time. Whatever you
16 store in a register remains there until you store something else in that
17 register. To see what a register @var{r} contains, use @kbd{M-x
21 @item M-x view-register @key{RET} @var{r}
22 Display a description of what register @var{r} contains.
26 @kbd{M-x view-register} reads a register name as an argument and then
27 displays the contents of the specified register.
30 * Position: RegPos. Saving positions in registers.
31 * Text: RegText. Saving text in registers.
32 * Rectangle: RegRect. Saving rectangles in registers.
33 * Configurations: RegConfig. Saving window configurations in registers.
34 * Files: RegFiles. File names in registers.
35 * Numbers: RegNumbers. Numbers in registers.
36 * Bookmarks:: Bookmarks are like registers, but persistent.
39 @node RegPos, RegText, Registers, Registers
40 @section Saving Positions in Registers
42 Saving a position records a place in a buffer so that you can move
43 back there later. Moving to a saved position switches to that buffer
44 and moves point to that place in it.
47 @item C-x r @key{SPC} @var{r}
48 Save position of point in register @var{r} (@code{point-to-register}).
50 Jump to the position saved in register @var{r} (@code{jump-to-register}).
54 @findex point-to-register
55 To save the current position of point in a register, choose a name
56 @var{r} and type @kbd{C-x r @key{SPC} @var{r}}. The register @var{r}
57 retains the position thus saved until you store something else in that
61 @findex jump-to-register
62 The command @kbd{C-x r j @var{r}} moves point to the position recorded
63 in register @var{r}. The register is not affected; it continues to
64 record the same location. You can jump to the same position using the
65 same register as often as you want.
67 If you use @kbd{C-x r j} to go to a saved position, but the buffer it
68 was saved from has been killed, @kbd{C-x r j} tries to create the buffer
69 again by visiting the same file. Of course, this works only for buffers
70 that were visiting files.
72 @node RegText, RegRect, RegPos, Registers
73 @section Saving Text in Registers
75 When you want to insert a copy of the same piece of text many times, it
76 can be impractical to use the kill ring, since each subsequent kill moves
77 the piece of text further down on the ring. It becomes hard to keep
78 track of the argument needed to retrieve the same text with @kbd{C-y}. An
79 alternative is to store the text in a register with @kbd{C-x r s}
80 (@code{copy-to-register}) and then retrieve it with @kbd{C-x r i}
81 (@code{insert-register}).
85 Copy region into register @var{r} (@code{copy-to-register}).
87 @itemx C-x r i @var{r}
88 Insert text contents of register @var{r} (@code{insert-register}).
94 @findex copy-to-register
95 @findex insert-register
96 @kbd{C-x r s @var{r}} stores a copy of the text of the region into the
97 register named @var{r}. Given a numeric argument, @kbd{C-x r s @var{r}}
98 deletes the text from the buffer as well.
100 @kbd{C-x r i @var{r}} inserts the text from register @var{r} in the buffer.
101 By default it leaves point before the text and places the mark after
102 it. With a numeric argument (@kbd{C-u}), it puts point after the text
103 and the mark before it.
105 @node RegRect, RegConfig, RegText, Registers
106 @section Saving Rectangles in Registers
109 A register can contain a rectangle instead of lines of text. The rectangle
110 is represented as a list of strings. @xref{Rectangles}, for basic
111 information on rectangles and how to specify rectangles in a buffer.
114 @findex copy-rectangle-to-register