[Top][All Lists]

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

enable-local-variables and emacs --batch

From: Kaushal Modi
Subject: enable-local-variables and emacs --batch
Date: Thu, 1 Nov 2018 10:54:02 -0400


I am unable to get the safe-marked variables to evaluate from
.dir-locals.el *only* when running emacs --batch.

For example, I have the below evaluated in emacs --batch --eval before
I load an Org file:

 (put 'org-hugo-section 'safe-local-variable 'stringp)

And this in .dir-locals.el:

((org-mode . ((org-hugo-section . "foo"))))

But the org-hugo-section does not get set to "foo".

If I open an Org file in the directory with that .dir-locals.el in a
non-batch regular Emacs session, C-h v org-hugo-section shows that
it's set to "foo", and I get no prompts to apply/save that local
variable (as expected because I have marked it as

So the only way I can make the .dir-locals.el apply that value is if I
do (setq enable-local-variables :all) when running emacs --batch.

But I don't consider that safe.

Why isn't the 'safe-local-variable attribute ignored only when running
emacs --batch?

My Emacs version: GNU Emacs 27.0.50 (build 34, x86_64-pc-linux-gnu,
GTK+ Version 2.24.23)
 of 2018-10-31, built using commit 42681c54bf5ea2ff9d2a3ec6553766b194454caf.


Kaushal Modi

reply via email to

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