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: Wed, 30 Sep 2009 02:11:37 +0300 Organization: JURTA Message-ID: <878wfxtmmy.fsf@mail.jurta.org> References: <7b501d5c0909220747m71565340m36be3026f91f5db8@mail.gmail.com> <230CB35D6D9A419EB943F0A276A78B72@us.oracle.com> <2460C0DD06EE4E898D61D81BA77529C4@us.oracle.com> <87iqf8qact.fsf@mail.jurta.org> <87fxabmk8d.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 1254266933 30769 80.91.229.12 (29 Sep 2009 23:28:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Sep 2009 23:28:53 +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 Wed Sep 30 01:28:46 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 1Msm7g-0001p2-NE for ged-emacs-devel@m.gmane.org; Wed, 30 Sep 2009 01:28:45 +0200 Original-Received: from localhost ([127.0.0.1]:33806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Msm7f-0005eq-Tx for ged-emacs-devel@m.gmane.org; Tue, 29 Sep 2009 19:28:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Msm7W-0005cj-1a for emacs-devel@gnu.org; Tue, 29 Sep 2009 19:28:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Msm7R-0005at-5f for emacs-devel@gnu.org; Tue, 29 Sep 2009 19:28:33 -0400 Original-Received: from [199.232.76.173] (port=37856 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Msm7R-0005aq-0J for emacs-devel@gnu.org; Tue, 29 Sep 2009 19:28:29 -0400 Original-Received: from smtp-out2.starman.ee ([85.253.0.4]:46011 helo=mx2.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Msm7Q-0002xR-FK for emacs-devel@gnu.org; Tue, 29 Sep 2009 19:28:28 -0400 X-Virus-Scanned: by Amavisd-New at mx2.starman.ee Original-Received: from mail.starman.ee (62.65.211.102.cable.starman.ee [62.65.211.102]) by mx2.starman.ee (Postfix) with ESMTP id E46363F40A0; Wed, 30 Sep 2009 02:28:19 +0300 (EEST) In-Reply-To: (Stefan Monnier's message of "Fri, 25 Sep 2009 10:16:28 -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:115794 Archived-At: >> (setq-default major-mode >> (lambda () (let ((buffer-file-name (buffer-name))) >> (set-auto-mode)))) > > That's also an alternative, yes. > So how 'bout the following: > - we (setq-default major-mode ..) along the lines of the above proposal. > - we get rid of the special case "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')." > - but we only do that for Emacs-24. > > The reason why I want to delay it to Emacs-24, is because I'm worried > that it may introduce bugs in very rare corner cases which will only > show up after a long testing period. For a long testing period we could make this change now, and remove it before releasing the next version. How otherwise we can find all corner cases. For instance, using the the setting above exposed one weird case: during visiting a tar archive it proposes to revert the just visited archive file. So visiting a file doesn't work correctly with default modes besides the standard fundamental-mode. The following default value would be better: (setq-default major-mode (lambda () (if buffer-file-name 'fundamental-mode (let ((buffer-file-name (buffer-name))) (set-auto-mode))))) -- Juri Linkov http://www.jurta.org/emacs/