]> code.delx.au - gnu-emacs/blobdiff - doc/emacs/regs.texi
Update copyright year to 2014 by running admin/update-copyright.
[gnu-emacs] / doc / emacs / regs.texi
index 42ce85c7ee137a0a74c98622b84f87961632cf4b..8ed0d848f5952b6c64abc6e036d1df7a9d65e9aa 100644 (file)
@@ -1,8 +1,8 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2011
-@c   Free Software Foundation, Inc.
+@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2014 Free Software
+@c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Registers, Display, Killing, Top
+@node Registers
 @chapter Registers
 @cindex registers
 
@@ -30,21 +30,22 @@ Display a description of what register @var{r} contains.
 @end table
 
   @dfn{Bookmarks} record files and positions in them, so you can
-return to those positions when you look at the file again.
-Bookmarks are similar enough in spirit to registers that they
-seem to belong in this chapter.
+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.
 
 @menu
-* Position: RegPos.           Saving positions in registers.
-* Text: RegText.              Saving text in registers.
-* Rectangle: RegRect.         Saving rectangles in registers.
-* Configurations: RegConfig.  Saving window configurations in registers.
-* Numbers: RegNumbers.        Numbers in registers.
-* Files: RegFiles.            File names in registers.
-* Bookmarks::                 Bookmarks are like registers, but persistent.
+* 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.
 @end menu
 
-@node RegPos
+@node Position Registers
 @section Saving Positions in Registers
 @cindex saving position in a register
 
@@ -76,7 +77,7 @@ was saved from has been killed, @kbd{C-x r j} tries to create the buffer
 again by visiting the same file.  Of course, this works only for buffers
 that were visiting files.
 
-@node RegText
+@node Text Registers
 @section Saving Text in Registers
 @cindex saving text in a register
 
@@ -92,6 +93,13 @@ Copy region into register @var{r} (@code{copy-to-register}).
 Insert text from register @var{r} (@code{insert-register}).
 @item M-x append-to-register @key{RET} @var{r}
 Append region to text in register @var{r}.
+
+@kindex C-x r +
+When register @var{r} contains text, you can use @kbd{C-x r +}
+(@code{increment-register}) to append to that register.  Note that
+command @kbd{C-x r +} behaves differently if @var{r} contains a
+number.  @xref{Number Registers}.
+
 @item M-x prepend-to-register @key{RET} @var{r}
 Prepend region to text in register @var{r}.
 @end table
@@ -116,14 +124,27 @@ region after appending it to the register.  The command
 the region text to the text in the register instead of
 @emph{appending} it.
 
+@vindex register-separator
+  When you are collecting text using @code{append-to-register} and
+@code{prepend-to-register}, you may want to separate individual
+collected pieces using a separator.  In that case, configure a
+@code{register-separator} and store the separator text in to that
+register.  For example, to get double newlines as text separator
+during the collection process, you can use the following setting.
+
+@example
+(setq register-separator ?+)
+(set-register register-separator "\n\n")
+@end example
+
 @kindex C-x r i
 @findex insert-register
   @kbd{C-x r i @var{r}} inserts in the buffer the text from register
-@var{r}.  Normally it leaves point before the text and places the mark
-after, but with a numeric argument (@kbd{C-u}) it puts point after the
-text and the mark before.
+@var{r}.  Normally it leaves point before the text and sets the mark
+after, without activating it.  With a numeric argument, it instead
+puts point after the text and the mark before.
 
-@node RegRect
+@node Rectangle Registers
 @section Saving Rectangles in Registers
 @cindex saving rectangle in a register
 
@@ -143,14 +164,11 @@ Insert the rectangle stored in register @var{r} (if it contains a
 rectangle) (@code{insert-register}).
 @end table
 
-  The @kbd{C-x r i @var{r}} command inserts a text string if the
-register contains one, and inserts a rectangle if the register contains
-one.
-
-  See also the command @code{sort-columns}, which you can think of
-as sorting a rectangle.  @xref{Sorting}.
+  The @kbd{C-x r i @var{r}} (@code{insert-register}) command,
+previously documented in @ref{Text Registers}, inserts a rectangle
+rather than a text string, if the register contains a rectangle.
 
-@node RegConfig
+@node Configuration Registers
 @section Saving Window Configurations in Registers
 @cindex saving window configuration in a register
 
@@ -178,7 +196,7 @@ restore a frame configuration, any existing frames not included in the
 configuration become invisible.  If you wish to delete these frames
 instead, use @kbd{C-u C-x r j @var{r}}.
 
-@node RegNumbers
+@node Number Registers
 @section Keeping Numbers in Registers
 @cindex saving number in a register
 
@@ -194,8 +212,10 @@ Store @var{number} into register @var{r} (@code{number-to-register}).
 @item C-u @var{number} C-x r + @var{r}
 @kindex C-x r +
 @findex increment-register
-Increment the number in register @var{r} by @var{number}
-(@code{increment-register}).
+If @var{r} contains a number, increment the number in that register by
+@var{number}.  Note that command @kbd{C-x r +}
+(@code{increment-register}) behaves differently if @var{r} contains
+text.  @xref{Text Registers}.
 @item C-x r i @var{r}
 Insert the number from register @var{r} into the buffer.
 @end table
@@ -205,7 +225,7 @@ register contents into the buffer.  @kbd{C-x r +} with no numeric
 argument increments the register value by 1; @kbd{C-x r n} with no
 numeric argument stores zero in the register.
 
-@node RegFiles
+@node File Registers
 @section Keeping File Names in Registers
 @cindex saving file name in a register
 
@@ -232,6 +252,23 @@ puts the file name shown in register @samp{z}.
 @var{r}}.  (This is the same command used to jump to a position or
 restore a frame configuration.)
 
+@node Keyboard Macro Registers
+@section Keyboard Macro Registers
+@cindex saving keyboard macro in a register
+@cindex keyboard macros, in registers
+
+@kindex C-x C-k x
+@findex kmacro-to-register
+  If you need to execute a keyboard macro (@pxref{Keyboard Macros})
+frequently, it is more convenient to put it in a register or save it
+(@pxref{Save Keyboard Macro}).  @kbd{C-x C-k x @var{r}}
+(@code{kmacro-to-register}) stores the last keyboard macro in register
+@var{r}.
+
+  To execute the keyboard macro in register @var{r}, type @kbd{C-x r j
+@var{r}}.  (This is the same command used to jump to a position or
+restore a frameset.)
+
 @node Bookmarks
 @section Bookmarks
 @cindex bookmarks
@@ -281,19 +318,26 @@ you can use it to edit your bookmark definitions or annotate the
 bookmarks.  Type @kbd{C-h m} in the bookmark buffer for more
 information about its special editing commands.
 
-  When you kill Emacs, Emacs offers to save your bookmark values in your
-default bookmark file, @file{~/.emacs.bmk}, if you have changed any
-bookmark values.  You can also save the bookmarks at any time with the
-@kbd{M-x bookmark-save} command.  The bookmark commands load your
-default bookmark file automatically.  This saving and loading is how
-bookmarks persist from one Emacs session to the next.
+  When you kill Emacs, Emacs saves your bookmarks, if
+you have changed any bookmark values.  You can also save the bookmarks
+at any time with the @kbd{M-x bookmark-save} command.  Bookmarks are
+saved to the file @file{~/.emacs.d/bookmarks} (for compatibility with
+older versions of Emacs, if you have a file named @file{~/.emacs.bmk},
+that is used instead).  The bookmark commands load your default
+bookmark file automatically.  This saving and loading is how bookmarks
+persist from one Emacs session to the next.
 
 @vindex bookmark-save-flag
   If you set the variable @code{bookmark-save-flag} to 1, each command
 that sets a bookmark will also save your bookmarks; this way, you
-don't lose any bookmark values even if Emacs crashes.  (The value, if
+don't lose any bookmark values even if Emacs crashes.  The value, if
 a number, says how many bookmark modifications should go by between
-saving.)
+saving.  If you set this variable to @code{nil}, Emacs only
+saves bookmarks if you explicitly use @kbd{M-x bookmark-save}.
+
+@vindex bookmark-default-file
+  The variable @code{bookmark-default-file} specifies the file in
+which to save bookmarks by default.
 
 @vindex bookmark-search-size
   Bookmark position values are saved with surrounding context, so that