Discussion:
Making tab-width a 'safe' variable
(too old to reply)
Bruce Mardle
2015-09-18 18:23:03 UTC
Permalink
Hi, all.
Is there some way I can make tab-width a 'safe' variable (when I open a file that wants to set it)?
I know how to OK setting it to specific values but I want Emacs not to query it being set to ANY value.
I'm using Emacs version 24.5.1.

(Incidentally, the info file says that when Emacs queries me about file variables, "you can tell Emacs to record all the variable/value pairs in
this file as safe, by typing '!' at the confirmation prompt". Nope!)
Tim Landscheidt
2015-09-19 21:02:06 UTC
Permalink
Post by Bruce Mardle
Is there some way I can make tab-width a 'safe' variable (when I open a file that wants to set it)?
I know how to OK setting it to specific values but I want Emacs not to query it being set to ANY value.
I'm using Emacs version 24.5.1.
(Incidentally, the info file says that when Emacs queries me about file variables, "you can tell Emacs to record all the variable/value pairs in
this file as safe, by typing '!' at the confirmation prompt". Nope!)
You can set/customize safe-local-variable-values for known
variable/value pairs. If you meant that you are aware of
that, I don't know of a way to put "ANY" in there, but the
range of tab-width values in the wild seems rather small to
me, so this shouldn't be an issue?

Tim
Michael Heerdegen
2015-09-20 14:26:10 UTC
Permalink
Hi, all. Is there some way I can make tab-width a 'safe' variable
(when I open a file that wants to set it)? I know how to OK setting
it to specific values but I want Emacs not to query it being set to
ANY value. I'm using Emacs version 24.5.1.
AFAIK by default, all integer values for `tab-width' already are
considered safe. Values that are not integers make no sense for
`tab-width' and are not considered safe.

In general this is controlled by the `safe-local-variable' symbol
property that should be a predicate (taking a value). In the case of
`tab-width' for example:

(get 'tab-width 'safe-local-variable)

==> integerp


If that doesn't help - what's your Emacs version? What related settings
do you use? What's your value of `enable-local-variables'?


Regards,

Michael.
Bruce Mardle
2015-10-10 14:02:43 UTC
Permalink
Thanks, Tim and Michael. Sorry about the slow response. I hadn't realised that Google wouldn't notify me of replies.
Post by Michael Heerdegen
AFAIK by default, all integer values for `tab-width' already are
considered safe. Values that are not integers make no sense for
`tab-width' and are not considered safe.
... What's your value of `enable-local-variables'?
Ah-ha! Solved! I had (setq enable-local-variables 'query) in my ~/.emacs for some strange reason (perhaps it made sense in an older version).
I now leave it set to the default 't.

Loading...