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: Thu, 24 Sep 2009 20:38:23 -0400 Message-ID: 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 1253839126 25443 80.91.229.12 (25 Sep 2009 00:38:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Sep 2009 00:38:46 +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 02:38:39 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 1Mqypa-0004hL-Ob for ged-emacs-devel@m.gmane.org; Fri, 25 Sep 2009 02:38:39 +0200 Original-Received: from localhost ([127.0.0.1]:52452 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqypZ-0003uP-PM for ged-emacs-devel@m.gmane.org; Thu, 24 Sep 2009 20:38:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MqypR-0003uC-Ai for emacs-devel@gnu.org; Thu, 24 Sep 2009 20:38:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MqypM-0003th-UJ for emacs-devel@gnu.org; Thu, 24 Sep 2009 20:38:28 -0400 Original-Received: from [199.232.76.173] (port=56991 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqypM-0003te-O7 for emacs-devel@gnu.org; Thu, 24 Sep 2009 20:38:24 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:31834 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MqypM-0002eP-CW for emacs-devel@gnu.org; Thu, 24 Sep 2009 20:38:24 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvQEAD+uu0pFpZBo/2dsb2JhbACBUtUMhBwFh34 X-IronPort-AV: E=Sophos;i="4.44,448,1249272000"; d="scan'208";a="46561962" Original-Received: from 69-165-144-104.dsl.teksavvy.com (HELO pastel.home) ([69.165.144.104]) by ironport2-out.pppoe.ca with ESMTP; 24 Sep 2009 20:38:23 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 1C5F680B1; Thu, 24 Sep 2009 20:38:23 -0400 (EDT) In-Reply-To: <87iqf8qact.fsf@mail.jurta.org> (Juri Linkov's message of "Fri, 25 Sep 2009 00:32:18 +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:115600 Archived-At: > *************** > *** 1190,1197 **** > (set (make-local-variable 'icomplete-with-completion-tables) > (cons rbts-completion-table > icomplete-with-completion-tables)))) > ! (read-buffer prompt (other-buffer (current-buffer)) > ! (confirm-nonexistent-file-or-buffer))))) > (defun switch-to-buffer-other-window (buffer-or-name &optional norecord) > "Select the buffer specified by BUFFER-OR-NAME in another window. > --- 1190,1202 ---- > (set (make-local-variable 'icomplete-with-completion-tables) > (cons rbts-completion-table > icomplete-with-completion-tables)))) > ! (let ((buffer (read-buffer prompt (other-buffer (current-buffer)) > ! (confirm-nonexistent-file-or-buffer)))) > ! (unless (get-buffer buffer) > ! (with-current-buffer (get-buffer-create buffer) > ! (let ((buffer-file-name (buffer-name))) > ! (normal-mode)))) > ! buffer)))) 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. Stefan