From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier 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 10:16:28 -0400 Message-ID: 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 1253888224 24217 80.91.229.12 (25 Sep 2009 14:17:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Sep 2009 14:17:04 +0000 (UTC) Cc: 'Kevin Rodgers' , Drew Adams , emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 25 16:16:56 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 1MrBbU-0002dJ-77 for ged-emacs-devel@m.gmane.org; Fri, 25 Sep 2009 16:16:56 +0200 Original-Received: from localhost ([127.0.0.1]:57522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrBbT-0007y3-Hc for ged-emacs-devel@m.gmane.org; Fri, 25 Sep 2009 10:16:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MrBb8-0007re-TZ for emacs-devel@gnu.org; Fri, 25 Sep 2009 10:16:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MrBb4-0007pd-8x for emacs-devel@gnu.org; Fri, 25 Sep 2009 10:16:34 -0400 Original-Received: from [199.232.76.173] (port=44510 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrBb4-0007pX-5J for emacs-devel@gnu.org; Fri, 25 Sep 2009 10:16:30 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:47938 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MrBb3-0007nA-HJ for emacs-devel@gnu.org; Fri, 25 Sep 2009 10:16:29 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap0FAA1tvEpFpYq6/2dsb2JhbACBUdVzhB4Fh30 X-IronPort-AV: E=Sophos;i="4.44,451,1249272000"; d="scan'208";a="46595196" Original-Received: from 69-165-138-186.dsl.teksavvy.com (HELO pastel.home) ([69.165.138.186]) by ironport2-out.pppoe.ca with ESMTP; 25 Sep 2009 10:16:28 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id A5EE980B1; Fri, 25 Sep 2009 10:16:28 -0400 (EDT) In-Reply-To: <87fxabmk8d.fsf@mail.jurta.org> (Juri Linkov's message of "Fri, 25 Sep 2009 12:04:05 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:115613 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)))) 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. Stefan