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#23463: safe local variable properties no longer effective Date: Fri, 6 May 2016 09:14:54 +0000 Message-ID: <20160506091453.GA3898@acm.fritz.box> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1462526147 522 80.91.229.3 (6 May 2016 09:15:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 May 2016 09:15:47 +0000 (UTC) Cc: 23463@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 06 11:15: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 1aybrD-00058S-48 for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 May 2016 11:15:35 +0200 Original-Received: from localhost ([::1]:57200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aybr4-0004ba-1T for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 May 2016 05:15:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aybqu-0004OF-Sv for bug-gnu-emacs@gnu.org; Fri, 06 May 2016 05:15:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aybqj-0004Up-88 for bug-gnu-emacs@gnu.org; Fri, 06 May 2016 05:15:11 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57024) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aybqj-0004Tp-4W for bug-gnu-emacs@gnu.org; Fri, 06 May 2016 05:15:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1aybqf-0007kY-QF for bug-gnu-emacs@gnu.org; Fri, 06 May 2016 05:15: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, 06 May 2016 09:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23463-submit@debbugs.gnu.org id=B23463.146252610029769 (code B ref 23463); Fri, 06 May 2016 09:15:01 +0000 Original-Received: (at 23463) by debbugs.gnu.org; 6 May 2016 09:15:00 +0000 Original-Received: from localhost ([127.0.0.1]:41128 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aybqe-0007k5-3u for submit@debbugs.gnu.org; Fri, 06 May 2016 05:15:00 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:41767) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aybqb-0007jv-Mu for 23463@debbugs.gnu.org; Fri, 06 May 2016 05:14:58 -0400 Original-Received: (qmail 66691 invoked by uid 3782); 6 May 2016 09:14:55 -0000 Original-Received: from acm.muc.de (p548C6264.dip0.t-ipconnect.de [84.140.98.100]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 06 May 2016 11:14:54 +0200 Original-Received: (qmail 4028 invoked by uid 1000); 6 May 2016 09:14:54 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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:117897 Archived-At: Hello, Glenn. On Thu, May 05, 2016 at 05:59:55PM -0400, Glenn Morris wrote: > Package: emacs > Version: 25.1.50 > emacs -Q foo.py > where foo.py has contents: > # Local Variables: > # python-indent-offset: 2 > # End: > Current emacs-25 branch: file opens fine with no prompting, > python-indent-offset is set to 2. > Current master: one is told that python-indent-offset is not safe Yes. What is happening is that the call to `fundamental-mode' at the beginning of `normal-mode' is itself calling `hack-local-variables' (via `run-mode-hooks'). This is wrong. At that stage, python-mode has not yet been loaded, so `hack-local-variables' doesn't know that `python-indent-offset' is "safe". > Same applies to any similar major-mode-specific local variable. > This is due to 25f455815bfaa868dc470d445413df9a7a546c46. Please try out the following, and let me know how it works: diff --git a/lisp/files.el b/lisp/files.el index d89b2f5..21f7bdc 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2316,7 +2316,10 @@ normal-mode or from Lisp without specifying the optional argument FIND-FILE; in that case, this function acts as if `enable-local-variables' were t." (interactive) - (fundamental-mode) + (kill-all-local-variables) + (unless delay-mode-hooks + (run-hooks 'change-major-mode-after-body-hook + 'after-change-major-mode-hook)) (let ((enable-local-variables (or (not find-file) enable-local-variables))) ;; FIXME this is less efficient than it could be, since both ;; s-a-m and h-l-v may parse the same regions, looking for "mode:". -- Alan Mackenzie (Nuremberg, Germany).