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: Kevin Rodgers
Subject: Re: Emacs ignores modified state of "untitled" buffer
Date: Thu, 20 May 2010 06:45:08 -0600
User-agent: Thunderbird 2.0.0.24 (Macintosh/20100228)

Stefan Vollmar 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?

See switch-to-new-untitled-buffer in
http://lists.gnu.org/archive/html/gnu-emacs-sources/2008-09/msg00016.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.

--
Kevin Rodgers
Denver, Colorado, USA




reply via email to

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