From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#23407: .dir-local settings get obliterated on running a major mode function. Date: Mon, 02 May 2016 00:02:11 -0400 Message-ID: References: <20160430102744.GA4644@acm.fritz.box> <0joa8rszhb.fsf@fencepost.gnu.org> <20160501212846.GA4228@acm.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1462161827 8012 80.91.229.3 (2 May 2016 04:03:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 May 2016 04:03:47 +0000 (UTC) Cc: yary , 23407@debbugs.gnu.org, Dmitry Gutov To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 02 06:03:35 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 1ax553-0000y8-IM for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 May 2016 06:03:33 +0200 Original-Received: from localhost ([::1]:35185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ax54w-0004Rl-AT for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 May 2016 00:03:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ax54n-0004G7-0d for bug-gnu-emacs@gnu.org; Mon, 02 May 2016 00:03:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ax54b-0001Vp-Cz for bug-gnu-emacs@gnu.org; Mon, 02 May 2016 00:03:11 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48818) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ax54b-0001Ue-9N for bug-gnu-emacs@gnu.org; Mon, 02 May 2016 00:03:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ax54Y-0006ea-Ea for bug-gnu-emacs@gnu.org; Mon, 02 May 2016 00:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 May 2016 04:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23407 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23407-submit@debbugs.gnu.org id=B23407.146216174025519 (code B ref 23407); Mon, 02 May 2016 04:03:02 +0000 Original-Received: (at 23407) by debbugs.gnu.org; 2 May 2016 04:02:20 +0000 Original-Received: from localhost ([127.0.0.1]:32922 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ax53r-0006dX-TX for submit@debbugs.gnu.org; Mon, 02 May 2016 00:02:20 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:3267) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ax53p-0006dK-IN for 23407@debbugs.gnu.org; Mon, 02 May 2016 00:02:18 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CYDQA731xV/0uLxEVcgxCEAshgBAICgTw8EQEBAQEBAQGBCkEFg10BAQMBViMFCwsOJhIUGA0kiDcIzyMBAQEBBgEBAQEeizqFBQeELQEEkDSJOZlSgUUjgjuBWSKCeAEBAQ X-IPAS-Result: A0CYDQA731xV/0uLxEVcgxCEAshgBAICgTw8EQEBAQEBAQGBCkEFg10BAQMBViMFCwsOJhIUGA0kiDcIzyMBAQEBBgEBAQEeizqFBQeELQEEkDSJOZlSgUUjgjuBWSKCeAEBAQ X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="221264334" Original-Received: from 69-196-139-75.dsl.teksavvy.com (HELO pastel.home) ([69.196.139.75]) by ironport2-out.teksavvy.com with ESMTP; 02 May 2016 00:02:11 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id B8F206037C; Mon, 2 May 2016 00:02:11 -0400 (EDT) In-Reply-To: <20160501212846.GA4228@acm.fritz.box> (Alan Mackenzie's message of "Sun, 1 May 2016 21:28:46 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) 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:117552 Archived-At: > Anyhow, I've hacked a patch together. The idea is to call > `hack-local-variables' from `run-mode-hooks' rather than from > `normal-mode'. Good idea. > + ;; delay-mode-hooks is set when `byte-compile-file' is the caller. > + ;; It is essential that we call `hack-local-variables' in order to > + ;; set up `lexical-binding', since `run-mode-hooks' is prevented > + ;; from doing its job. > + (when delay-mode-hooks > + (with-demoted-errors "File local-variables error: %s" > + (hack-local-variables 'no-mode)))) But this seems terribly brittle. Do we care about delay-mode-hooks (as the code says) or about byte-compile-file (as the comment says)? If it's the former, then the comment needs to be fixed, if it's the latter, than we need to find some other way to tell this code what's going on. Stefan