Difference between revisions of "Registers"

From WikEmacs
Jump to navigation Jump to search
(make a table)
(typo)
Line 6: Line 6:
  
  
* Position: Saving positions in registers.
+
 
* Text: Saving text in registers.
 
* Rectangle: Saving rectangles in registers.
 
* Configurations: Saving window configurations in registers.
 
* Numbers: Numbers in registers.
 
* Files: File names in registers.
 
* Bookmarks: Bookmarks are like registers, but persistent.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 33: Line 27:
 
|Rectangle
 
|Rectangle
 
|C-x r r '''r'''
 
|C-x r r '''r'''
|C-x r i '''r'''
+
|''insert:'' C-x r i '''r'''
 
|
 
|
 
|-
 
|-
 
|Window Config
 
|Window Config
|C-x r w x
+
|C-x r w '''r'''
 
|''restore:'' C-x r j '''r'''
 
|''restore:'' C-x r j '''r'''
 
|''save all frame's window:'' C-x r f x
 
|''save all frame's window:'' C-x r f x
Line 49: Line 43:
 
| (set-register ?z '(fine . name))
 
| (set-register ?z '(fine . name))
 
| ''jump:'' C-x r j '''r'''
 
| ''jump:'' C-x r j '''r'''
 +
|
 
|}
 
|}
 +
 +
== Bookmark ==
 +
[[Bookmark]] can be thought register with a long name and surviving between Emacs session.
 +
 
[[Category:Text Editing]]
 
[[Category:Text Editing]]

Revision as of 04:24, 30 March 2012

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’.

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



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 x
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

Bookmark

Bookmark can be thought register with a long name and surviving between Emacs session.