(Selective Undo): New node, text moved from basic.texi.
[bpt/emacs.git] / man / mark.texi
index 5f4c44d..c472dff 100644 (file)
@@ -1,5 +1,6 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985,86,87,93,94,95,1997,2001 Free Software Foundation, Inc.
+@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002,
+@c   2003, 2004, 2005 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Mark, Killing, Help, Top
 @chapter The Mark and the Region
@@ -43,6 +44,7 @@ mark in the @dfn{mark ring}.
                          when there is one.
 * Momentary Mark::      Enabling Transient Mark mode momentarily.
 * Using Region::       Summary of ways to operate on contents of the region.
+* Selective Undo::      Undoing within a given region.
 * Marking Objects::    Commands to put region around textual units.
 * Mark Ring::          Previous mark positions saved so you can go back there.
 * Global Mark Ring::    Previous mark positions in various buffers.
@@ -296,11 +298,31 @@ Fill it as text with @kbd{M-x fill-region} (@pxref{Filling}).
 Print hardcopy with @kbd{M-x print-region} (@pxref{Printing}).
 @item
 Evaluate it as Lisp code with @kbd{M-x eval-region} (@pxref{Lisp Eval}).
+@item
+Undo changes within it using @kbd{C-u C-x u} (@pxref{Selective Undo}).
 @end itemize
 
   Most commands that operate on the text in the region have the word
 @code{region} in their names.
 
+@node Selective Undo
+@section Selective Undo
+
+@cindex selective undo
+@kindex C-u C-x u
+  Ordinary undo applies to all changes made in the current buffer.  You
+can also perform @dfn{selective undo}, limited to the current region
+(@pxref{Mark}).
+
+  To do this, specify the region you want, then run the @code{undo}
+command with a prefix argument (the value does not matter): @kbd{C-u
+C-x u} or @kbd{C-u C-_}.  This undoes the most recent change in the
+region.  To undo further changes in the same region, repeat the
+@code{undo} command (no prefix argument is needed).  In Transient Mark
+mode (@pxref{Transient Mark}), any use of @code{undo} when there is an
+active region performs selective undo; you do not need a prefix
+argument.
+
 @node Marking Objects
 @section Commands to Mark Textual Objects
 
@@ -382,10 +404,12 @@ C-@key{SPC}} (or @kbd{C-u C-@@}); this is the command
 where the mark was, and restores the mark from the ring of former
 marks.
 
-  If you repeat the character @kbd{C-@key{SPC}}, after typing @kbd{C-u
-C-@key{SPC}}, each repetition moves point to a previous mark position
-from the ring.  The mark positions you move through in this way are
-not lost; they go to the end of the ring.
+@vindex set-mark-command-repeat-pop
+  If you set @code{set-mark-command-repeat-pop} to non-@code{nil},
+then when you repeat the character @kbd{C-@key{SPC}} after typing
+@kbd{C-u C-@key{SPC}}, each repetition moves point to a previous mark
+position from the ring.  The mark positions you move through in this
+way are not lost; they go to the end of the ring.
 
   Each buffer has its own mark ring.  All editing commands use the current
 buffer's mark ring.  In particular, @kbd{C-u C-@key{SPC}} always stays in