From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#23827: 25.1.50; tab-width file-local variable has no effect in etc/HELLO Date: 24 Jun 2016 11:07:13 -0000 Organization: muc.de e.V. Message-ID: <20160624110713.13909.qmail@mail.muc.de> References: <83k2hh40ix.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1466766512 2873 80.91.229.3 (24 Jun 2016 11:08:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Jun 2016 11:08:32 +0000 (UTC) To: 23827@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 24 13:08:21 2016 Return-path: Envelope-to: geb-bug-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 1bGOy9-0002Yu-R1 for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Jun 2016 13:08:17 +0200 Original-Received: from localhost ([::1]:42642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGOy5-0003gr-K6 for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Jun 2016 07:08:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGOxz-0003ga-CF for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2016 07:08:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGOxu-0005gk-2Z for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2016 07:08:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGOxt-0005gg-VS for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2016 07:08:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bGOxt-00067D-Op for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2016 07:08:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jun 2016 11:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23827 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23827-submit@debbugs.gnu.org id=B23827.146676643723436 (code B ref 23827); Fri, 24 Jun 2016 11:08:01 +0000 Original-Received: (at 23827) by debbugs.gnu.org; 24 Jun 2016 11:07:17 +0000 Original-Received: from localhost ([127.0.0.1]:53458 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGOxA-00065u-Nx for submit@debbugs.gnu.org; Fri, 24 Jun 2016 07:07:16 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:21286) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGOx8-00065d-Ch for 23827@debbugs.gnu.org; Fri, 24 Jun 2016 07:07:15 -0400 Original-Received: (qmail 13910 invoked by uid 3782); 24 Jun 2016 11:07:13 -0000 In-Reply-To: X-Newsgroups: gnu.emacs.bug User-Agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.3-RELEASE-p4 (amd64)) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:119997 Archived-At: Hello, Eli. In article you wrote: > From: eliz@HOME-C4E4A596F7.i-did-not-set--mail-host-address--so-tickle-me > --text follows this line-- > To reproduce: > emacs -Q > C-h H > Observe the messed-up alignment of the second column. The reason is > that the tab-width file-local variable setting didn't take effect; > setting the variable by hand fixes the display. > I suspect this change: > commit 26171e02773b9b2383f412dd79d241385d2d20df > Author: Alan Mackenzie > Date: Fri May 6 18:58:49 2016 +0000 > Correct hack-local-variables change from Thu May 5 11:05:49 2016 +0000 > Prevent hack-local-variables being called from the fundamental-mode mode call > early in normal-mode. This fixes bug #23460 and bug #23463. > * lisp/files.el (normal-mode) Replace call to fundamental-mode with calls to > the things it calls, with the exception of hack-local-variables. > * etc/NEWS: Add an entry to note the calling of hack-local-variables at each > major mode initialization. Yes. That change (and the change it corrected) shifted the call of `hack-local-variables' from the act of visiting a file, to the calling of the major mode function. Every major mode (including fundamental-mode) calls `run-mode-hooks' which calls `hack-local-variables'. However, the C function `set-buffer-major-mode', optimises the call to `fundamental-mode' away, because that call previously didn't do anything. (`set-buffer-major-mode' is the last fallback function which choses the major mode when all other methods have been tried and failed in `set-auto-mode'.) So I propose to remove that special optimisation from `set-buffer-major-mode', so that `fundamental-mode' actually gets called. As an alternative, it would be possible to add special handling at the Lisp level for `fundamental-mode', but I think that would be a worse fix. Here's my proposed patch, which works: diff --git a/src/buffer.c b/src/buffer.c index b4b8304..8756cbb 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1984,7 +1984,9 @@ the current buffer's major mode. */) function = BVAR (current_buffer, major_mode); } - if (NILP (function) || EQ (function, Qfundamental_mode)) + if (NILP (function)) /* If function is `fundamental-mode', allow it to run + so that `run-mode-hooks' and thus + `hack-local-variables' get run. */ return Qnil; count = SPECPDL_INDEX (); What do you think? > In GNU Emacs 25.1.50.166 (i686-pc-mingw32) > of 2016-06-22 built on HOME-C4E4A596F7 > Repository revision: cc113e557d56d849e9699ceb3bc4a735c628b46e > Windowing system distributor 'Microsoft Corp.', version 5.1.2600 > Recent messages: > For information about GNU Emacs and the GNU system, type C-h C-a. [ .... ] -- Alan Mackenzie (Nuremberg, Germany).