Auto-saving does not normally write to the files you visited, because it can be undesirable to save a program that is in an inconsistent state when you have made only half of a planned change. Instead, auto-saving is done in a different file called the auto-save file, and the visited file is changed only when you save explicitly, for example, with C-x C-s.
Normally, the name of the auto-save file is generated by appending
‘#’ to the front and back of the visited file name. Thus, a buffer
visiting file foo.c would be 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 generated by appending ‘#%’ to the front and ‘#’ to the
back of buffer name. For example, the ‘*mail*’ buffer in which you
compose messages to be sent is auto-saved in a file named
#%*mail*#. Names of auto-save files are generated this way
unless you customize the functions
auto-save-file-name-p to do something different. The file name
to be used for auto-saving a buffer is calculated at the time auto-saving is
turned on in that buffer.
If you want auto-saving to be done in the visited file, set the variable
auto-save-visited-file-name to be non-
nil. In this mode,
there is really no difference between auto-saving and explicit saving.
Emacs deletes a buffer’s auto-save file when you explicitly save the
buffer. To inhibit the deletion, set the variable
nil. Changing the visited file
name with C-x C-w or
set-visited-file-name renames any
auto-save file to correspond to the new visited name.