Auto-saving does not normally save in the files that you visited, because it can be very undesirable to save a change that you did not want to make permanent. Instead, auto-saving is done in a different file called the auto-save file, and the visited file is changed only when you request saving explicitly (such as with C-x C-s).
Normally, the auto-save file name is made by appending ‘#’ to the
front and rear of the visited file name. Thus, a buffer visiting file
foo.c is auto-saved in a file #foo.c#. Most buffers that
are not visiting files are auto-saved only if you request it explicitly;
when they are auto-saved, the auto-save file name is made by appending
‘#’ to the front and rear of buffer name, then
adding digits and letters at the end for uniqueness. For
example, the *mail* buffer in which you compose messages to be
sent might be auto-saved in a file named #*mail*#704juu. Auto-save file
names are made this way unless you reprogram parts of Emacs to do
something different (the functions
auto-save-file-name-p). The file name to be used for auto-saving
in a buffer is calculated when auto-saving is turned on in that buffer.
auto-save-file-name-transforms allows a degree
of control over the auto-save file name. It lets you specify a series
of regular expressions and replacements to transform the auto save
file name. The default value puts the auto-save files for remote
files (see Remote Files) into the temporary file directory on the
When you delete a substantial part of the text in a large buffer, auto save turns off temporarily in that buffer. This is because if you deleted the text unintentionally, you might find the auto-save file more useful if it contains the deleted text. To reenable auto-saving after this happens, save the buffer with C-x C-s, or use C-u 1 M-x auto-save-mode.
If you want auto-saving to be done in the visited file rather than
in a separate auto-save file, set the variable
auto-save-visited-file-name to a non-
nil value. In this
mode, there is no real difference between auto-saving and explicit
A buffer's auto-save file is deleted when you save the buffer in its
visited file. (You can inhibit this by setting the variable
nil.) Changing the visited
file name with C-x C-w or
any auto-save file to go with the new visited name.