Bug 154985

Summary: emacs should always warn before losing data
Product: [Fedora] Fedora Reporter: John Smith <johnsmith7219>
Component: emacsAssignee: Jens Petersen <petersen>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3Keywords: FutureFeature
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-10-03 08:48:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Smith 2005-04-15 12:18:42 UTC
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):
emacs-21.3-21.FC3

How reproducible:
Always

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.

Additional info:

"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.

Comment 1 Jens Petersen 2005-10-03 08:48:40 UTC
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
on closing.