Red Hat Bugzilla – Bug 154985
emacs should always warn before losing data
Last modified: 2007-11-30 17:11:04 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.6) Gecko/20050323 Fedora/1.7.6-1.3.2
Description of problem:
When a new buffer is created (with C-x b f o o RET, not with C-x f ...)
but not saved as a file, emacs doesn't warn that its contents will be
lost when the user hits C-x C-c.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Launch emacs.
2. Type C-x b f o o RET b a r C-x C-c
3. Now emacs has closed without warning.
Actual Results: The contents of the buffer (here, "bar") are lost.
Expected Results: emacs should ask "modified buffers exist; exit anyway ?".
Or at least there should be a configurable option for this.
"You should use C-x b only to switch to an existing buffer, and C-x f to
create a new buffer" is not an adequate answer. I often need temporary
buffers, like *scratch*, for data which I certainly do not want to save
to a file, but which I however do not want to lose if I inadvertently
hit C-x C-c. And even though C-x f will not create the file if the contents
are not saved, it is intended for data which is meant to be saved. Example:
with a default configuration, if you create a buffer with C-x f, write something
in it, then hit C-x C-c and answer "n" to "Save this buffer ?" and then "yes"
to "Exit anyway ?", you will have an autosave #file# lying around.
As you quote, this is indeed the intended behaviour by upstream.
If you want to take this up further you suggest requesting the
change to be make upstream on the emacs-devel mailing list.
But Emacs has behaved this way for a very long time, so you
may find it easier to switch your usual usage to using C-x C-f
instead of C-x C-b to create new buffers. :-) Or if you really
want to write a small elisp extension to warning you about
buffers, but the intention is that buffer that don't have
an associated file are temporary and don't need to be saved