14.4 Reverting a Buffer
If you have made extensive changes to a file and then change your mind
about them, you can get rid of all changes by reading in the previous
version of the file. To do this, use `M-x revert-buffer', which
operates on the current buffer. Since reverting a buffer can result in
very extensive changes, you must confirm it with `yes'.
You may request that `revert-buffer' check for an auto-save file
that is more recent than the visited file by providing a prefix
argument. If a recent auto-save file exists, `revert-buffer' offers to
read the auto-save file instead of the visited file (Note: Auto
Save). Emacs asks you about the auto-save file before the request
for confirmation of the `revert-buffer' operation, and demands `y' or
`n' as an answer. If you have started to type `yes' to confirm the
revert operation, the `y' will answer the question about using the
auto-save file, but the `es' will not be valid confirmation for the
reversion. This gives you a chance to cancel the operation with `C-g'
and try again with the answers you really intend.
`revert-buffer' preserves the value of point (in characters from the
beginning of the file). If the file was edited only slightly, you will
be at approximately the same piece of text after reverting as before.
If you have made more extensive changes, after reversion point may be
in a totally different context than your last edits before reversion.
A buffer reverted from its visited file is marked "not modified"
until you make a change. The buffer's modes will also be recalculated,
Some kinds of buffers whose contents reflect data bases other than
files, such as Dired buffers, can also be reverted. For them,
reverting means refreshing their contents from the appropriate data.
Buffers created randomly with `C-x b' cannot be reverted;
`revert-buffer' reports an error when asked to do so.
automatically generated by info2www version 18.104.22.168