all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: enable-local-variables and emacs --batch
Date: Sat, 03 Nov 2018 11:16:54 +0200	[thread overview]
Message-ID: <83a7mqfrll.fsf@gnu.org> (raw)
In-Reply-To: <CAFyQvY2psY45A-31Nz5aXwEhtcXgA5fH4Yp5RyKGmYNnos5_KQ@mail.gmail.com> (message from Kaushal Modi on Thu, 1 Nov 2018 10:54:02 -0400)

> 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.



  reply	other threads:[~2018-11-03  9:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01 14:54 enable-local-variables and emacs --batch Kaushal Modi
2018-11-03  9:16 ` Eli Zaretskii [this message]
2018-11-03 10:05   ` Kaushal Modi
2018-11-03 10:46     ` Eli Zaretskii
2018-11-03 11:18       ` Kaushal Modi
2018-11-03 11:21         ` Kaushal Modi
2018-11-03 12:49           ` Kaushal Modi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a7mqfrll.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.