]> code.delx.au - gnu-emacs/commit
Call hack-local-variables from major modes rather than from file visiting
authorAlan Mackenzie <acm@muc.de>
Thu, 5 May 2016 11:05:49 +0000 (11:05 +0000)
committerAlan Mackenzie <acm@muc.de>
Thu, 5 May 2016 11:05:49 +0000 (11:05 +0000)
commit25f455815bfaa868dc470d445413df9a7a546c46
treeb0c56ba886eda0dfe5b0e200d59051dafd644488
parent6aad36ace9953b9672b13be68416d205532d5e59
Call hack-local-variables from major modes rather than from file visiting

This prevents file/directory local variables from being lost when the major
mode is set or changed.

This fixes bug #15577 and bug #23407.

* lisp/files.el (normal-mode): Call `hack-local-variables' when the major mode
function hasn't already done so.
(hack-local-variables): Rename parameter `mode-only' to `handle-mode', make
its previous non-nil setting be t, and introduce the following action for a
non-nil non-t value: apply all settings apart from `mode'.

* lisp/subr.el (run-mode-hooks): call `hack-local-variables' for buffers
which are visiting files.

* doc/emacs/custom.texi (File Variables): Note that setting a major mode also
sets file variables.
(Directory Variables): Note that `mode', `eval', and `unibyte' can be set as
dir local variables, but `coding' can't.

* doc/lispref/modes.texi (Major Mode Conventions): Say that `run-mode-hooks'
also calls `hack-local-variables'.
(Auto Major Mode): Say that `find-file' no longer runs `hack-local-variables',
as from 25.2.  Remove vagueness from `normal-mode' and `set-auto-mode' by
saying that the mode IS SET, not merely "selected" or "chosen".
(Mode Hooks): Document change to `run-mode-hooks'.

* doc/lispref/variables.texi (File Local Variables): Document change to
`hack-local-variables'.
doc/emacs/custom.texi
doc/lispref/modes.texi
doc/lispref/variables.texi
lisp/files.el
lisp/subr.el