From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: new buffer - should its mode reflect its name when the name matches auto-mode-alist? Date: Fri, 25 Sep 2009 12:04:05 +0300 Organization: JURTA Message-ID: <87fxabmk8d.fsf@mail.jurta.org> References: <7b501d5c0909220747m71565340m36be3026f91f5db8@mail.gmail.com> <230CB35D6D9A419EB943F0A276A78B72@us.oracle.com> <2460C0DD06EE4E898D61D81BA77529C4@us.oracle.com> <87iqf8qact.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1253872459 5583 80.91.229.12 (25 Sep 2009 09:54:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Sep 2009 09:54:19 +0000 (UTC) Cc: 'Kevin Rodgers' , Drew Adams , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 25 11:54:11 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 1Mr7VD-0005LI-5e for ged-emacs-devel@m.gmane.org; Fri, 25 Sep 2009 11:54:11 +0200 Original-Received: from localhost ([127.0.0.1]:54600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mr7VC-0001Me-JV for ged-emacs-devel@m.gmane.org; Fri, 25 Sep 2009 05:54:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mr7Ti-0000sc-Fo for emacs-devel@gnu.org; Fri, 25 Sep 2009 05:52:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mr7Td-0000rq-Ir for emacs-devel@gnu.org; Fri, 25 Sep 2009 05:52:37 -0400 Original-Received: from [199.232.76.173] (port=34705 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mr7Td-0000rn-BR for emacs-devel@gnu.org; Fri, 25 Sep 2009 05:52:33 -0400 Original-Received: from smtp-out1.starman.ee ([85.253.0.3]:52005 helo=mx1.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mr7Tc-0004Mr-Tm for emacs-devel@gnu.org; Fri, 25 Sep 2009 05:52:33 -0400 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (82.131.96.214.cable.starman.ee [82.131.96.214]) by mx1.starman.ee (Postfix) with ESMTP id 001743F40A9; Fri, 25 Sep 2009 12:52:22 +0300 (EEST) In-Reply-To: (Stefan Monnier's message of "Thu, 24 Sep 2009 20:38:23 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:115611 Archived-At: > I'm not opposed to such a change but I think it would need to come > together with a cleanup of the "default-major-mode" thingy: currently, > the major-mode of a buffer is either set (in set-buffer-major-mode) as > (default-value 'major-mode) or (if that's nil) is inherited from the > major-mode of the current-buffer (unless that major-mode has the > `mode-class' property set to `special'). > > In practice, for 99% of the users, (default-value 'major-mode) is > fundamental-mode, so the rest is very rarely used, which can lead to > corner-case bugs, of course. Using (setq-default major-mode 'normal-mode) would be a good default. Currently this runs into an infinite recursion. However, the following succeeds: (setq-default major-mode (lambda () (let ((buffer-file-name (buffer-name))) (set-auto-mode)))) -- Juri Linkov http://www.jurta.org/emacs/