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: Fri, 21 May 2010 07:20:11 -0700 Message-ID: <8E1EF5747B7A4183A0873F02FDBBF398@us.oracle.com> 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 1274451866 481 80.91.229.12 (21 May 2010 14:24:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 21 May 2010 14:24:26 +0000 (UTC) To: "'Kevin Rodgers'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 21 16:24:25 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 1OFT9E-0007aA-I3 for geh-help-gnu-emacs@m.gmane.org; Fri, 21 May 2010 16:24:24 +0200 Original-Received: from localhost ([127.0.0.1]:38480 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFT9D-0002Pr-S3 for geh-help-gnu-emacs@m.gmane.org; Fri, 21 May 2010 10:24:23 -0400 Original-Received: from [140.186.70.92] (port=58213 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFT6c-0000oN-HU for help-gnu-emacs@gnu.org; Fri, 21 May 2010 10:21:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFT6a-0000vo-9Q for help-gnu-emacs@gnu.org; Fri, 21 May 2010 10:21:41 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:64831) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFT6a-0000vd-2A for help-gnu-emacs@gnu.org; Fri, 21 May 2010 10:21:40 -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 o4LELarW025449 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 May 2010 14:21:37 GMT Original-Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o4L37J3E026422; Fri, 21 May 2010 14:21:34 GMT Original-Received: from abhmt018.oracle.com by acsmt355.oracle.com with ESMTP id 288026381274451613; Fri, 21 May 2010 07:20:13 -0700 Original-Received: from dradamslap1 (/141.144.88.147) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 21 May 2010 07:20:12 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Thread-Index: Acr4iPVoApvFsSLWSw6rDa08+OFUoQAXoTOg X-Auth-Type: Internal IP X-Source-IP: acsinet15.oracle.com [141.146.126.227] X-CT-RefId: str=0001.0A090208.4BF696F1.01EB: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:73716 Archived-At: > > 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? > > C-x C-s won't ask. > > I can think of a couple nuisances: > > * If the buffer gets saved to file "untitled", a subsequent > invocation of emacs will visit that file, not an empty buffer. > > * Changes to the buffer will be auto-saved to the #untitled# > file, and a subsequent invocation of emacs will ask to recover > the file (if the 2 invocations are concurrent, or if the first > invocation exited uncleanly). I see. It's clear now; thanks. C-x C-s saves quietly (to the `buffer-file-name') without asking for a target file (since it already has an associated file name). The behavior of most programs is different: If no _previously saved_ file is associated with the buffer, then trying to save makes the program ask for a file name. For the first save, users are typically required to use `Save As' (or else `Save' acts as `Save As' before the first save). Your code implements, I think, just what is needed for the OP (and others). It provides autosaving, saving without asking if already saved once, and saving with asking if not yet saved. You've offered this as command `switch-to-new-buffer' and put it on the `Buffers' menu as `Select New Buffer'. I would prefer that it be considered an improved behavior for `Visit New File', which is currently just `find-file'. The use of your command is, I think, for new file buffers only, so that intention should be reflected in both the command name and menu-item name. The `Buffers' menu is the wrong place for this, IMO. So I would suggest changing the command name to something like `new-file' or `visit-new-file' and (more importantly) replacing the `File' > `Visit New File' menu item with it. Those who are most likely to use such a menu item are newbies who expect that behavior. Any Emacs veteran who prefers `find-file' will not be likely to use the menu and choose `Visit New File'. And it is clear what a `new-file' command is for. I agree with Lennart that you should think about proposing this to emacs-devel. I would support it, especially with the changes I just mentioned.