Registers
*********

Emacs registers are places in which you can save text or positions for later use.  Text saved in a register can be copied into the buffer once or many times; a position saved in a register is used by moving point to that position.  Rectangles can also be copied into and out of registers (see Rectangles).

Each register has a name, which is a single character.  A register can store either a piece of text, a position, or a rectangle, but only one thing at any given time.  Whatever you store in a register remains there until you store something else in that register.

M-x view-register RET R
     Display a description of what register R contains.

M-x view-register reads a register name as an argument and then displays the contents of the specified register.

Saving Positions in Registers
=============================

Saving a position records a spot in a buffer so you can move back there later.  Moving to a saved position re-selects the buffer and moves point to the spot.

C-x r SPC R
     Save the location of point in register R (point-to-register).

C-x r j R
     Jump to the location saved in register R (register-to-point).

To save the current location of point in a register, choose a name R and type C-x r SPC R.  The register R retains the location thus saved until you store something else in that register.

The command C-x r j R moves point to the location recorded in register R.  The register is not affected; it continues to record the same location.  You can jump to the same position using the same register as often as you want.

Saving Text in Registers
========================

When you want to insert a copy of the same piece of text many times, it can be impractical to use the kill ring, since each subsequent kill moves the piece of text further down on the ring.  It becomes hard to keep track of the argument needed to retrieve the same text with C-y.  An alternative is to store the text in a register with C-x r s (copy-to-register) and then retrieve it with C-x r g (insert-register).

C-x r s R
     Copy region into register R (copy-to-register).

C-x r g R
     Insert text contents of register R (insert-register).

C-x r s R stores a copy of the text of the region into the register named R.  Given a numeric argument, C-x r s deletes the text from the buffer as well.

C-x r g R inserts the text from register R in the buffer. By default it leaves point before the text and places the mark after it. With a numeric argument, it puts point after the text and the mark before it.

Saving Rectangles in Registers
==============================

A register can contain a rectangle instead of lines of text.  The rectangle is represented as a list of strings.  See Rectangles, for basic information on rectangles and how to specify rectangles in a buffer.

C-x r r R
     Copy the region-rectangle into register R(copy-rectangle-to-register). With a numeric argument, delete it as well.

C-x r g R
     Insert the rectangle stored in register R (if it contains a rectangle) (insert-register).

The C-x r g command inserts linear text if the register contains that, or inserts a rectangle if the register contains one.