13 Registers
Emacs registers are compartments where you can save text, rectangles, positions, and other things for later use. Once you save text or a rectangle in a register, you can copy it into the buffer once or many times; once you save a position in a register, you can jump back to that position once or many times.
Each register has a name that consists of a single character, which we will denote by r
; r
can be a letter (such as βa
β) or a number (such as β1
β); case matters, so register βa
β is not the same as register βA
β. You can also set a register in non-alphanumeric characters, for instance β*
β or βC-d
β. Note, itβs not possible to set a register in βC-g
β or βESC
β, because these keys are reserved for quitting (see Quitting).
A register can store a position, a piece of text, a rectangle, a number, a window configuration, or a file name, but only one thing at any given time. Whatever you store in a register remains there until you store something else in that register. To see what register r
contains, use M-x view-register
:
M-x view-register RET r
β
Display a description of what register r
contains.
All of the commands that prompt for a register will display a preview window that lists the existing registers (if there are any) after a short delay. To change the length of the delay, customize register-preview-delay
. To prevent this display, set that option to nil
. You can explicitly request a preview window by pressing C-h
or F1
.
Bookmarks record files and positions in them, so you can return to those positions when you look at the file again. Bookmarks are similar in spirit to registers, so they are also documented in this chapter.
β’ Position Registers | Β Β | Saving positions in registers. |
β’ Text Registers | Β Β | Saving text in registers. |
β’ Rectangle Registers | Β Β | Saving rectangles in registers. |
β’ Configuration Registers | Β Β | Saving window configurations in registers. |
β’ Number Registers | Β Β | Numbers in registers. |
β’ File Registers | Β Β | File names in registers. |
β’ Keyboard Macro Registers | Β Β | Keyboard macros in registers. |
β’ Bookmarks | Β Β | Bookmarks are like registers, but persistent. |