[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: enable-local-variables and emacs --batch
From: |
Eli Zaretskii |
Subject: |
Re: enable-local-variables and emacs --batch |
Date: |
Sat, 03 Nov 2018 11:16:54 +0200 |
> From: Kaushal Modi <kaushal.modi@gmail.com>
> 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
> safe-local-variable).
>
> 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?
You didn't show any actual command you are using for the batch-mode
invocation, but my first guess would be that the file is visited
before the --eval command-line option is executed.