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: Drew Adams
Subject: RE: Emacs ignores modified state of "untitled" buffer
Date: Thu, 20 May 2010 06:29:53 -0700

>  > 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?
> 
> See switch-to-new-untitled-buffer in
> http://lists.gnu.org/archive/html/gnu-emacs-sources/2008-09/ms
> g00016.html
> 
> Here is the Commentary:
> 
> ;; The switch-to-new-buffer command is like switch-to-buffer, but it
> ;; generates a new buffer name instead of prompting the user.  It sets
> ;; buffer-offer-save to protect against inadvertant data loss via
> ;; kill-emacs.  And it adds a buffer-local query function to protect
> ;; against inadvertant data loss via kill-buffer.
> ;;
> ;; switch-to-new-scratch-buffer and switch-to-new-untitled buffer are
> ;; convenience commands, for creating new *scratch* buffers 
> (like Emacs)
> ;; and new "Untitled" buffers (like other text editors).
> ;;
> ;; switch-to-new-buffer is added to the menu bar Buffers menu.

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.




reply via email to

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