18.2 Saving Text in Registers
When you want to insert a copy of the same piece of text several
times, it may be inconvenient to yank it from the kill ring, since each
subsequent kill moves that entry further down the ring. An alternative
is to store the text in a register and later retrieve it.
- C-x r s r
- Copy region into register r (
- C-x r i r
- Insert text from register r (
- M-x append-to-register <RET> r
- Append region to text in register r.
- M-x prepend-to-register <RET> r
- Prepend region to text in register r.
C-x r s r stores a copy of the text of the region into
the register named r. C-u C-x r s r, the same
command with a numeric argument, deletes the text from the buffer as
well; you can think of this as “moving” the region text into the register.
M-x append-to-register <RET> r appends the copy of
the text in the region to the text already stored in the register
named r. If invoked with a numeric argument, it deletes the
region after appending it to the register. The command
prepend-to-register is similar, except that it prepends
the region text to the text in the register, rather than
C-x r i r inserts in the buffer the text from register
r. Normally it leaves point before the text and places the mark
after, but with a numeric argument (C-u) it puts point after the
text and the mark before.