[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Applying file local variables -- why all-or-nothing?

From: Christian Schlauer
Subject: Applying file local variables -- why all-or-nothing?
Date: Sat, 18 Aug 2007 09:50:34 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)


[Short summary: the choice shouldn't be whether to apply /the local
variables list/ -- it should be whether to apply /those local
variables in the list that may not be safe/.]

,----[ C-h v enable-local-variables RET ]
| enable-local-variables is a variable defined in `files.el'.
| Its value is t
| Documentation:
| Control use of local variables in files you visit.
| The value can be t, nil, :safe, or something else.
| A value of t means file local variables specifications are obeyed
| if all the specified variable values are safe; if any values are
| not safe, Emacs queries you, once, whether to set them all.

That is correct -- `emacs -q --no-site-file foo.tex' with foo.tex

--8<---------------cut here---------------start------------->8---


%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
--8<---------------cut here---------------end--------------->8---


--8<---------------cut here---------------start------------->8---
The local variables list in foo.tex
contains values that may not be safe (*).

Do you want to apply it?  You can type
y  -- to apply the local variables list.
n  -- to ignore the local variables list.
!  -- to apply the local variables list, and permanently mark these
      values (*) as safe (in the future, they will be set automatically.)

    mode : latex
  * TeX-master : t
--8<---------------cut here---------------end--------------->8---

The problem is that one can _only_ apply or ignore the _whole_ local
variables list -- "whether to set them all" in the above doc-string.

Even if both the above doc-string and the window *Local Variables*
clearly say that the local variable _list_ is applied or ignored, TRT
(IMO) would be to

,----[ C-h v enable-local-variables RET ]
| [...]; if any values are not safe, Emacs applies the specified
| variable values that are safe and queries you, once, whether to set
| the ones that may not be safe.

That would be much more what I'd expect: warn me about possibly unsafe
variables and ask me whether to apply *the unsafe ones* -- but treat
the safe ones as always when `enable-local-variables' is t: simply
apply them. The current "all-or-no-local-variables" approach is not
intuitive as safe local variables are always safe, no matter in what
"bad company" they are.

(The above leads to problems in AUCTeX with multifile documents where
an unsafe file local variable, together with pressing `n' when asked
about applying the local variables list, leads to AUCTeX not being
able to compile the multifile document, see
Christian Schlauer

reply via email to

[Prev in Thread] Current Thread [Next in Thread]