From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: Hook doesn't run as expected, if buffer mode is set from major-mode Date: Fri, 8 Jan 2016 18:07:14 -0800 (PST) Message-ID: References: <87h9in4zee.fsf@linux-qg7d.fritz.box> <87d1tb4ngj.fsf@linux-qg7d.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1452305274 1051 80.91.229.3 (9 Jan 2016 02:07:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Jan 2016 02:07:54 +0000 (UTC) To: Rolf Ade , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jan 09 03:07:42 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aHiwO-0003Nk-BL for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Jan 2016 03:07:40 +0100 Original-Received: from localhost ([::1]:38692 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHiwJ-0001qw-Q2 for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Jan 2016 21:07:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHiw8-0001qn-5m for help-gnu-emacs@gnu.org; Fri, 08 Jan 2016 21:07:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aHiw4-0003hJ-39 for help-gnu-emacs@gnu.org; Fri, 08 Jan 2016 21:07:24 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:51463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHiw3-0003gA-Sx for help-gnu-emacs@gnu.org; Fri, 08 Jan 2016 21:07:20 -0500 Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u0927Hej017688 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sat, 9 Jan 2016 02:07:18 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u0927FeM005340 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sat, 9 Jan 2016 02:07:17 GMT Original-Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id u0927FHq002292; Sat, 9 Jan 2016 02:07:15 GMT In-Reply-To: <87d1tb4ngj.fsf@linux-qg7d.fritz.box> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108667 Archived-At: > >> If the major mode of a new buffer is determined by the variable > >> major-mode (nothing from auto-mode-alist et. al matches), then the > >> hooks of that major mode doesn't run, as I expect. > > > > `major-mode' is a buffer-local variable. > > It is set by the newly current major mode. > > IOW, you cannot use it to set the mode, as the mode sets it. >=20 > So, what do you think determines the major-mode of a new buffer, if (as > I wrote) nothing from auto-mode-alist, interpreter-mode-alist and > magic-mode-alist matches? What should I use for that (if I don't want > the default fundamental-mode)? Well, I was wrong, it seems; sorry. I was going to say "Customize option `default-major-mode', but `C-h v' tells me this: This variable is obsolete since 23.2; use `major-mode' instead. Documentation: Value of `major-mode' for new buffers. So you can still customize it (I do), but you can also just customize `major-mode', to provide the default value. And `C-h v major mode' tells you how it works. Summary: it works just like `default-major-mode' works (and used to work). The current doc string for option `major-mode' is identical to the pre-Emacs 23.2 doc string for `default-major-mode' (except for the first line). Seems to me that it was less confusing before this change, but I suppose there were good reasons that offset the added confusion. Unfortunately, they did not put anything in the Emacs 23.2 NEWS about this change, so you would need to do a bit of archaeology to find the rationale for the change. > Take a look at C-h v major-mode RET. (And, maybe, C-h v > default-major-mode RET). Right. Sorry for introducing confusion.