help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs ignores modified state of "untitled" buffer


From: Stefan Vollmar
Subject: Re: Emacs ignores modified state of "untitled" buffer
Date: Thu, 20 May 2010 16:00:02 +0200

Dear Drew,

On 20.05.2010, at 15:29, Drew Adams wrote:

>>> we have a user who wants to always open Emacs with a new "untitled"
>>> buffer so he can start writing right away without having 
>>> to think of a file name first (similar to a "New Document" feature
>>> in Mac and Windows programs). If we try this in site-start.el:
>>> 
>>> (generate-new-buffer "untitled")
>>> (switch-to-buffer "untitled")
>>> 
>>> we are almost there - Emacs starts with the new "untitled"
>>> buffer. However, if he then exits Emacs, Emacs does not 
>>> warn about a modified buffer and potential data loss, although the 
>>> buffer is marked dirty. How can we get the usual behaviour for
>>> this new buffer?

[...]

> What am I missing? What is wrong with just using (find-file "untitled")?
> 
> If a buffer is associated with a file name (which is what `find-file' does) 
> then
> Emacs asks you about saving it.  What else is the OP asking for?
> 
> Everyone seems to be jumping through hoops here, and my mail with this simple
> suggestion was ignored, so I must not be getting it. I really would like to 
> know
> what I'm missing.


Sorry for being late with our reply (your first answer was almost within 
seconds of the intial question - superb!), but I was only now able to test it.

(find-file "untitled")

does indeed solve our specific problem quite neatly. Maybe one thing could 
still be improved: if the "untitled" buffer is dirty and Emacs asks where to 
save it, the directory now defaults to Emacs' bin directory - so

(find-file "~/untitled")

is an even better choice for us. switch-to-new-untitled-buffer does not seem to 
be part of Emacs 23.2.

Thanks!

Warm regards,
 Stefan
-- 
Dr. Stefan Vollmar, Dipl.-Phys.
Head of IT group
Max-Planck-Institut für neurologische Forschung
Gleuelerstr. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213  FAX +49-221-4726-298
Tel.: +49-221-478-5713  Mobile: 0160-93874279
Email: vollmar@nf.mpg.de   http://www.nf.mpg.de






Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]