Merge remote-tracking branch 'origin/master' into for-steve
[sxemacs] / info / sxemacs / undo.texi
1 @node Undo, Minibuffer, Basic, Top
2 @chapter Undoing Changes
3 @cindex undo
4 @cindex mistakes, correcting
5
6   Emacs allows you to undo all changes you make to the text of a buffer,
7 up to a certain amount of change (8000 characters).  Each buffer records
8 changes individually, and the undo command always applies to the
9 current buffer.  Usually each editing command makes a separate entry
10 in the undo records, but some commands such as @code{query-replace}
11 make many entries, and very simple commands such as self-inserting
12 characters are often grouped to make undoing less tedious.
13
14 @table @kbd
15 @item C-x u
16 Undo one batch of changes (usually, one command's worth) (@code{undo}).
17 @item C-_
18 The same.
19 @end table
20
21 @kindex C-x u
22 @kindex C-_
23 @findex undo
24   The command @kbd{C-x u} or @kbd{C-_} allows you to undo changes.  The
25 first time you give this command, it undoes the last change.  Point
26 moves to the text affected by the undo, so you can see what was undone.
27
28   Consecutive repetitions of the @kbd{C-_} or @kbd{C-x u} commands undo
29 earlier and earlier changes, back to the limit of what has been
30 recorded.  If all recorded changes have already been undone, the undo
31 command prints an error message and does nothing.
32
33   Any command other than an undo command breaks the sequence of undo
34 commands.  Starting at this moment, the previous undo commands are
35 considered ordinary changes that can themselves be undone.  Thus, you can
36 redo changes you have undone by typing @kbd{C-f} or any other command
37 that have no important effect, and then using more undo commands.
38
39   If you notice that a buffer has been modified accidentally, the
40 easiest way to recover is to type @kbd{C-_} repeatedly until the stars
41 disappear from the front of the mode line.  When that happens, all the
42 modifications you made have been canceled.  If you do not remember
43 whether you changed the buffer deliberately, type @kbd{C-_} once. When
44 you see Emacs undo the last change you made, you probably remember why you
45 made it.  If the change was an accident, leave it undone.  If it was
46 deliberate, redo the change as described in the preceding paragraph.
47
48   Whenever an undo command makes the stars disappear from the mode line,
49 the buffer contents is the same as it was when the file was last read in
50 or saved.
51
52   Not all buffers record undo information.  Buffers whose names start with
53 spaces don't; these buffers are used internally by Emacs and its extensions
54 to hold text that users don't normally look at or edit.  Minibuffers,
55 help buffers, and documentation buffers also don't record undo information.
56
57   Emacs can remember at most 8000 or so characters of deleted or
58 modified text in any one buffer for reinsertion by the undo command.
59 There is also a limit on the number of individual insert, delete, or
60 change actions that Emacs can remember.
61
62   There are two keys to run the @code{undo} command, @kbd{C-x u} and
63 @kbd{C-_}, because on some keyboards, it is not obvious how to type
64 @kbd{C-_}. @kbd{C-x u} is an alternative you can type in the same
65 fashion on any terminal.