From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: new buffer - should its mode reflect its name when the name matches auto-mode-alist? Date: Wed, 23 Sep 2009 20:14:14 -0700 Message-ID: <2460C0DD06EE4E898D61D81BA77529C4@us.oracle.com> References: <7b501d5c0909220747m71565340m36be3026f91f5db8@mail.gmail.com><230CB35D6D9A419EB943F0A276A78B72@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1253762082 18682 80.91.229.12 (24 Sep 2009 03:14:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Sep 2009 03:14:42 +0000 (UTC) To: "'Kevin Rodgers'" , Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 24 05:14:34 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mqemv-0000Y0-Vs for ged-emacs-devel@m.gmane.org; Thu, 24 Sep 2009 05:14:34 +0200 Original-Received: from localhost ([127.0.0.1]:44008 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mqemv-0001NA-07 for ged-emacs-devel@m.gmane.org; Wed, 23 Sep 2009 23:14:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mqemr-0001N5-3K for emacs-devel@gnu.org; Wed, 23 Sep 2009 23:14:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mqeml-0001Hb-IM for emacs-devel@gnu.org; Wed, 23 Sep 2009 23:14:27 -0400 Original-Received: from [199.232.76.173] (port=59317 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mqeml-0001HC-Bx for emacs-devel@gnu.org; Wed, 23 Sep 2009 23:14:23 -0400 Original-Received: from acsinet11.oracle.com ([141.146.126.233]:24276) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mqemk-0004q4-U5 for emacs-devel@gnu.org; Wed, 23 Sep 2009 23:14:23 -0400 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by acsinet11.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n8O3FHn6007223 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 24 Sep 2009 03:15:19 GMT Original-Received: from abhmt016.oracle.com (abhmt016.oracle.com [141.146.116.25]) by acsinet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n8O3En7u016235; Thu, 24 Sep 2009 03:14:49 GMT Original-Received: from dradamslap1 (/141.144.88.192) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 23 Sep 2009 20:14:16 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Aco8v3FBBxzK0qOhRWGSIAEP/atvKAABUPhw X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: abhmt016.oracle.com [141.146.116.25] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090209.4ABAE409.00C5:SCFSTAT5015188,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:115572 Archived-At: > >>> Haven't thought about this before, but I wonder if the mode > >>> should respect auto-mode-alist when you create a new buffer? > >>> There's no doubt a good reason or > >>> two why we don't do this - just wondering. > >>> > >>> E.g. `C-x b foo.el', where there is no existing buffer > >>> foo.el. The mode is > >>> Fundamental; should it be Emacs-Lisp instead? > >>> > >>> (I realize that a new buffer need not be intended to be > >>> saved as a file.) > >>> > >> As an end-user and not having contributed anything to > >> Emacs myself, I would expect the buffer to "respect" > >> auto-mode-alist, i.e. set the mode depending on the > >> buffer name. However, I think the default behavior when > >> creating buffers non-interactively should *not* respect > >> auto-mode-alist. > > > > Yes, I meant interactively only, but should have made that > > clear. Thx. > > I think I posted this in response to a request on > gnu.emacs.help, back around 2008-11-18, but I can't find it > via Google: > > (defadvice switch-to-buffer (around interactive-normal-mode activate) > "When called interactively to create a new buffer not > visiting a file, temporarily bind `buffer-file-name' and call > `normal-mode'." > (let ((existing-buffer (get-buffer (ad-get-arg 0)))) > ad-do-it > (when (and (interactive-p) > (null existing-buffer) > (null buffer-file-name)) > (let ((buffer-file-name (expand-file-name (buffer-name)))) > (normal-mode))))) > > Not appropriate for src/buffer.c of course, but you get the idea. Yes, you did - I see it now. You posted it on 2009-11-18, with Subject "emacs mode line suggestions".