From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: Emacs ignores modified state of "untitled" buffer Date: Thu, 20 May 2010 06:29:53 -0700 Message-ID: References: <51707DDA-8D52-4D9F-9FD4-461987F2DEDE@nf.mpg.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1274362350 16984 80.91.229.12 (20 May 2010 13:32:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 20 May 2010 13:32:30 +0000 (UTC) To: "'Kevin Rodgers'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 20 15:32:29 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OF5rQ-0003Nf-6G for geh-help-gnu-emacs@m.gmane.org; Thu, 20 May 2010 15:32:28 +0200 Original-Received: from localhost ([127.0.0.1]:51232 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OF5rP-0006Tu-7e for geh-help-gnu-emacs@m.gmane.org; Thu, 20 May 2010 09:32:27 -0400 Original-Received: from [140.186.70.92] (port=56917 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OF5qa-0006GE-FH for help-gnu-emacs@gnu.org; Thu, 20 May 2010 09:31:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OF5qN-0002oF-7a for help-gnu-emacs@gnu.org; Thu, 20 May 2010 09:31:36 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:59858) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OF5qM-0002nv-Vp for help-gnu-emacs@gnu.org; Thu, 20 May 2010 09:31:23 -0400 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o4KDVIag010409 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 20 May 2010 13:31:19 GMT Original-Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o4KAoXqr027196; Thu, 20 May 2010 13:31:17 GMT Original-Received: from abhmt015.oracle.com by acsmt353.oracle.com with ESMTP id 284452741274362196; Thu, 20 May 2010 06:29:56 -0700 Original-Received: from dradamslap1 (/141.144.168.134) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 20 May 2010 06:29:56 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: Acr4GmYk/zU8KBJVRsaiscjDQ16gtQABTSzg In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-Auth-Type: Internal IP X-Source-IP: acsinet15.oracle.com [141.146.126.227] X-CT-RefId: str=0001.0A090206.4BF539A8.0035:SCFMA922111,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:73686 Archived-At: > > 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.