all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#23463: safe local variable properties no longer effective
@ 2016-05-05 21:59 Glenn Morris
  2016-05-06  9:14 ` Alan Mackenzie
  2016-05-06 19:24 ` Alan Mackenzie
  0 siblings, 2 replies; 5+ messages in thread
From: Glenn Morris @ 2016-05-05 21:59 UTC (permalink / raw)
  To: 23463; +Cc: Alan Mackenzie

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

Same applies to any similar major-mode-specific local variable.

This is due to 25f455815bfaa868dc470d445413df9a7a546c46.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#23463: safe local variable properties no longer effective
  2016-05-05 21:59 bug#23463: safe local variable properties no longer effective Glenn Morris
@ 2016-05-06  9:14 ` Alan Mackenzie
  2016-05-06 15:55   ` Glenn Morris
  2016-05-06 19:24 ` Alan Mackenzie
  1 sibling, 1 reply; 5+ messages in thread
From: Alan Mackenzie @ 2016-05-06  9:14 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 23463

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).





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#23463: safe local variable properties no longer effective
  2016-05-06  9:14 ` Alan Mackenzie
@ 2016-05-06 15:55   ` Glenn Morris
  2016-05-06 19:34     ` Alan Mackenzie
  0 siblings, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2016-05-06 15:55 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 23463


A test case was provided so you can test it yourself. :)
This is a change to very long-standing behaviour, and I would not be
surprised to see various subtle issues due to it. Eg calling any
major-mode function may now prompt the user and wait indefinitely for a
response.

I think it needs a NEWS entry, BTW.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#23463: safe local variable properties no longer effective
  2016-05-05 21:59 bug#23463: safe local variable properties no longer effective Glenn Morris
  2016-05-06  9:14 ` Alan Mackenzie
@ 2016-05-06 19:24 ` Alan Mackenzie
  1 sibling, 0 replies; 5+ messages in thread
From: Alan Mackenzie @ 2016-05-06 19:24 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 23463-done

Bug fixed in master branch.

-- 
Alan Mackenzie (Nuremberg, Germany).





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#23463: safe local variable properties no longer effective
  2016-05-06 15:55   ` Glenn Morris
@ 2016-05-06 19:34     ` Alan Mackenzie
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Mackenzie @ 2016-05-06 19:34 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 23463

Hello, Glenn.

On Fri, May 06, 2016 at 11:55:27AM -0400, Glenn Morris wrote:

> A test case was provided so you can test it yourself. :)

I have done so.  But sometimes, admittedly not very often, a fix works
in the test case, but not in the real code the error was observed in.

Anyhow, I've committed the fix.

> This is a change to very long-standing behaviour, and I would not be
> surprised to see various subtle issues due to it. Eg calling any
> major-mode function may now prompt the user and wait indefinitely for a
> response.

This could happen, but only on a file the user has already
accepted/rejected the local variables for.

> I think it needs a NEWS entry, BTW.

Done.

-- 
Alan Mackenzie (Nuremberg, Germany).





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-06 19:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-05 21:59 bug#23463: safe local variable properties no longer effective Glenn Morris
2016-05-06  9:14 ` Alan Mackenzie
2016-05-06 15:55   ` Glenn Morris
2016-05-06 19:34     ` Alan Mackenzie
2016-05-06 19:24 ` Alan Mackenzie

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.