diff options
| -rw-r--r-- | doc/emacs/regs.texi | 80 |
1 files changed, 43 insertions, 37 deletions
diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi index 6be26123a65..f42692d7b4c 100644 --- a/doc/emacs/regs.texi +++ b/doc/emacs/regs.texi | |||
| @@ -9,16 +9,20 @@ | |||
| 9 | Emacs @dfn{registers} are compartments where you can save text, | 9 | Emacs @dfn{registers} are compartments where you can save text, |
| 10 | rectangles, positions, and other things for later use. Once you save | 10 | rectangles, positions, and other things for later use. Once you save |
| 11 | text or a rectangle in a register, you can copy it into the buffer | 11 | text or a rectangle in a register, you can copy it into the buffer |
| 12 | once, or many times; you can move point to a position saved in a | 12 | once, or many times; once you save a position in a register, you can |
| 13 | register once, or many times. | 13 | jump back to that position once, or many times. |
| 14 | |||
| 15 | Each register has a name that consists of a single character, which | ||
| 16 | we will denote by @var{r}; @var{r} can be a letter (such as @samp{a}) | ||
| 17 | or a number (such as @samp{1}); case matters, so register @samp{a} is | ||
| 18 | not the same as register @samp{A}. | ||
| 14 | 19 | ||
| 15 | @findex view-register | 20 | @findex view-register |
| 16 | Each register has a name, which consists of a single character. A | 21 | A register can store a position, a piece of text, a rectangle, a |
| 17 | register can store a number, a piece of text, a rectangle, a position, | 22 | number, a window configuration, or a file name, but only one thing at |
| 18 | a window configuration, or a file name, but only one thing at any | 23 | any given time. Whatever you store in a register remains there until |
| 19 | given time. Whatever you store in a register remains there until you | 24 | you store something else in that register. To see what register |
| 20 | store something else in that register. To see what a register @var{r} | 25 | @var{r} contains, use @kbd{M-x view-register}: |
| 21 | contains, use @kbd{M-x view-register}. | ||
| 22 | 26 | ||
| 23 | @table @kbd | 27 | @table @kbd |
| 24 | @item M-x view-register @key{RET} @var{r} | 28 | @item M-x view-register @key{RET} @var{r} |
| @@ -44,30 +48,28 @@ seem to belong in this chapter. | |||
| 44 | @section Saving Positions in Registers | 48 | @section Saving Positions in Registers |
| 45 | @cindex saving position in a register | 49 | @cindex saving position in a register |
| 46 | 50 | ||
| 47 | Saving a position records a place in a buffer so that you can move | ||
| 48 | back there later. Moving to a saved position switches to that buffer | ||
| 49 | and moves point to that place in it. | ||
| 50 | |||
| 51 | @table @kbd | 51 | @table @kbd |
| 52 | @item C-x r @key{SPC} @var{r} | 52 | @item C-x r @key{SPC} @var{r} |
| 53 | Save position of point in register @var{r} (@code{point-to-register}). | 53 | Record the position of point and the current buffer in register |
| 54 | @var{r} (@code{point-to-register}). | ||
| 54 | @item C-x r j @var{r} | 55 | @item C-x r j @var{r} |
| 55 | Jump to the position saved in register @var{r} (@code{jump-to-register}). | 56 | Jump to the position and buffer saved in register @var{r} |
| 57 | (@code{jump-to-register}). | ||
| 56 | @end table | 58 | @end table |
| 57 | 59 | ||
| 58 | @kindex C-x r SPC | 60 | @kindex C-x r SPC |
| 59 | @findex point-to-register | 61 | @findex point-to-register |
| 60 | To save the current position of point in a register, choose a name | 62 | Typing @kbd{C-x r @key{SPC}} (@code{point-to-register}), followed by |
| 61 | @var{r} and type @kbd{C-x r @key{SPC} @var{r}}. The register @var{r} | 63 | a character @kbd{@var{r}}, saves both the position of point and the |
| 62 | retains the position thus saved until you store something else in that | 64 | current buffer in register @var{r}. The register retains this |
| 63 | register. | 65 | information until you store something else in it. |
| 64 | 66 | ||
| 65 | @kindex C-x r j | 67 | @kindex C-x r j |
| 66 | @findex jump-to-register | 68 | @findex jump-to-register |
| 67 | The command @kbd{C-x r j @var{r}} moves point to the position recorded | 69 | The command @kbd{C-x r j @var{r}} switches to the buffer recorded in |
| 68 | in register @var{r}. The register is not affected; it continues to | 70 | register @var{r}, and moves point to the recorded position. The |
| 69 | hold the same position. You can jump to the saved position any number | 71 | contents of the register are not changed, so you can jump to the saved |
| 70 | of times. | 72 | position any number of times. |
| 71 | 73 | ||
| 72 | If you use @kbd{C-x r j} to go to a saved position, but the buffer it | 74 | If you use @kbd{C-x r j} to go to a saved position, but the buffer it |
| 73 | was saved from has been killed, @kbd{C-x r j} tries to create the buffer | 75 | was saved from has been killed, @kbd{C-x r j} tries to create the buffer |
| @@ -95,24 +97,27 @@ Prepend region to text in register @var{r}. | |||
| 95 | @end table | 97 | @end table |
| 96 | 98 | ||
| 97 | @kindex C-x r s | 99 | @kindex C-x r s |
| 98 | @kindex C-x r i | ||
| 99 | @findex copy-to-register | 100 | @findex copy-to-register |
| 100 | @findex insert-register | ||
| 101 | @kbd{C-x r s @var{r}} stores a copy of the text of the region into | 101 | @kbd{C-x r s @var{r}} stores a copy of the text of the region into |
| 102 | the register named @var{r}. @kbd{C-u C-x r s @var{r}}, the same | 102 | the register named @var{r}. If the mark is inactive, Emacs first |
| 103 | command with a numeric argument, deletes the text from the buffer as | 103 | reactivates the mark where it was last set. The mark is deactivated |
| 104 | well; you can think of this as ``moving'' the region text into the register. | 104 | at the end of this command. @xref{Mark}. @kbd{C-u C-x r s @var{r}}, |
| 105 | the same command with a prefix argument, copies the text into register | ||
| 106 | @var{r} and deletes the text from the buffer as well; you can think of | ||
| 107 | this as ``moving'' the region text into the register. | ||
| 105 | 108 | ||
| 106 | @findex append-to-register | 109 | @findex append-to-register |
| 107 | @findex prepend-to-register | 110 | @findex prepend-to-register |
| 108 | @kbd{M-x append-to-register @key{RET} @var{r}} appends the copy of | 111 | @kbd{M-x append-to-register @key{RET} @var{r}} appends the copy of |
| 109 | the text in the region to the text already stored in the register | 112 | the text in the region to the text already stored in the register |
| 110 | named @var{r}. If invoked with a numeric argument, it deletes the | 113 | named @var{r}. If invoked with a prefix argument, it deletes the |
| 111 | region after appending it to the register. The command | 114 | region after appending it to the register. The command |
| 112 | @code{prepend-to-register} is similar, except that it @emph{prepends} | 115 | @code{prepend-to-register} is similar, except that it @emph{prepends} |
| 113 | the region text to the text in the register, rather than | 116 | the region text to the text in the register instead of |
| 114 | @emph{appending} it. | 117 | @emph{appending} it. |
| 115 | 118 | ||
| 119 | @kindex C-x r i | ||
| 120 | @findex insert-register | ||
| 116 | @kbd{C-x r i @var{r}} inserts in the buffer the text from register | 121 | @kbd{C-x r i @var{r}} inserts in the buffer the text from register |
| 117 | @var{r}. Normally it leaves point before the text and places the mark | 122 | @var{r}. Normally it leaves point before the text and places the mark |
| 118 | after, but with a numeric argument (@kbd{C-u}) it puts point after the | 123 | after, but with a numeric argument (@kbd{C-u}) it puts point after the |
| @@ -122,9 +127,9 @@ text and the mark before. | |||
| 122 | @section Saving Rectangles in Registers | 127 | @section Saving Rectangles in Registers |
| 123 | @cindex saving rectangle in a register | 128 | @cindex saving rectangle in a register |
| 124 | 129 | ||
| 125 | A register can contain a rectangle instead of linear text. The | 130 | A register can contain a rectangle instead of linear text. |
| 126 | rectangle is represented as a list of strings. @xref{Rectangles}, for | 131 | @xref{Rectangles}, for basic information on how to specify a rectangle |
| 127 | basic information on how to specify a rectangle in the buffer. | 132 | in the buffer. |
| 128 | 133 | ||
| 129 | @table @kbd | 134 | @table @kbd |
| 130 | @findex copy-rectangle-to-register | 135 | @findex copy-rectangle-to-register |
| @@ -155,7 +160,8 @@ as sorting a rectangle. @xref{Sorting}. | |||
| 155 | @kindex C-x r f | 160 | @kindex C-x r f |
| 156 | You can save the window configuration of the selected frame in a | 161 | You can save the window configuration of the selected frame in a |
| 157 | register, or even the configuration of all windows in all frames, and | 162 | register, or even the configuration of all windows in all frames, and |
| 158 | restore the configuration later. | 163 | restore the configuration later. @xref{Windows}, for information |
| 164 | about window configurations. | ||
| 159 | 165 | ||
| 160 | @table @kbd | 166 | @table @kbd |
| 161 | @item C-x r w @var{r} | 167 | @item C-x r w @var{r} |
| @@ -283,10 +289,10 @@ default bookmark file automatically. This saving and loading is how | |||
| 283 | bookmarks persist from one Emacs session to the next. | 289 | bookmarks persist from one Emacs session to the next. |
| 284 | 290 | ||
| 285 | @vindex bookmark-save-flag | 291 | @vindex bookmark-save-flag |
| 286 | If you set the variable @code{bookmark-save-flag} to 1, then each | 292 | If you set the variable @code{bookmark-save-flag} to 1, each command |
| 287 | command that sets a bookmark will also save your bookmarks; this way, | 293 | that sets a bookmark will also save your bookmarks; this way, you |
| 288 | you don't lose any bookmark values even if Emacs crashes. (The value, | 294 | don't lose any bookmark values even if Emacs crashes. (The value, if |
| 289 | if a number, says how many bookmark modifications should go by between | 295 | a number, says how many bookmark modifications should go by between |
| 290 | saving.) | 296 | saving.) |
| 291 | 297 | ||
| 292 | @vindex bookmark-search-size | 298 | @vindex bookmark-search-size |