Difference between revisions of "Registers"
Jump to navigation
Jump to search
(Created page with "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 ...") |
m (Added helm-register tip to visualize registers) |
||
(20 intermediate revisions by 10 users not shown) | |||
Line 1: | Line 1: | ||
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. | 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. | ||
− | + | == Naming convention == | |
+ | There are 62 registers, each with a single character for a name: | ||
− | A | + | * from a to z |
+ | * from A to Z, different from a to z | ||
+ | * from 0 to 9 | ||
+ | == Functions == | ||
+ | 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. | ||
− | + | == How to use == | |
− | + | {| class="wikitable" | |
− | + | |- | |
− | + | ! Type | |
− | + | ! How to save | |
− | + | ! How to use | |
− | * | + | ! Other useful command |
+ | |- | ||
+ | |Position | ||
+ | |C-x r <SPC> '''r''' | ||
+ | |''jump:'' C-x r j '''r''' | ||
+ | | | ||
+ | |- | ||
+ | |Text | ||
+ | |C-x r s '''r''' | ||
+ | |''insert:'' C-x r i '''r''' | ||
+ | | m-x append-toregister <RET> '''r'''; m-x prepend-to-register <RET> '''r''' | ||
+ | |- | ||
+ | |Rectangle | ||
+ | |C-x r r '''r''' | ||
+ | |''insert:'' C-x r i '''r''' | ||
+ | | | ||
+ | |- | ||
+ | |Window Config | ||
+ | |C-x r w '''r''' | ||
+ | |''restore:'' C-x r j '''r''' | ||
+ | |''save all frame's window:'' C-x r f '''r''' | ||
+ | |- | ||
+ | |Number | ||
+ | |C-u number C-x r n '''r''' | ||
+ | |''insert:'' C-x r i '''r''' | ||
+ | |''increment:'' C-x r + '''r''' | ||
+ | |- | ||
+ | | File | ||
+ | | (set-register ?z '(fine . name)) | ||
+ | | ''jump:'' C-x r j '''r''' | ||
+ | | | ||
+ | |} | ||
+ | * To see what register r contains, use M-x view-register | ||
+ | * To visualize what register r contains with helm you can M-x [https://tuhdo.github.io/helm-intro.html#sec-19 helm-register] | ||
+ | |||
+ | == Bookmark == | ||
+ | [[Bookmarks]] can be thought as register with a long name and surviving between Emacs session. | ||
+ | |||
+ | [[Category:Text Editing]] |
Latest revision as of 19:19, 1 November 2014
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.
Naming convention
There are 62 registers, each with a single character for a name:
- from a to z
- from A to Z, different from a to z
- from 0 to 9
Functions
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.
How to use
Type | How to save | How to use | Other useful command |
---|---|---|---|
Position | C-x r <SPC> r | jump: C-x r j r | |
Text | C-x r s r | insert: C-x r i r | m-x append-toregister <RET> r; m-x prepend-to-register <RET> r |
Rectangle | C-x r r r | insert: C-x r i r | |
Window Config | C-x r w r | restore: C-x r j r | save all frame's window: C-x r f r |
Number | C-u number C-x r n r | insert: C-x r i r | increment: C-x r + r |
File | (set-register ?z '(fine . name)) | jump: C-x r j r |
- To see what register r contains, use M-x view-register
- To visualize what register r contains with helm you can M-x helm-register
Bookmark
Bookmarks can be thought as register with a long name and surviving between Emacs session.