From: Kaushal Modi <kaushal.modi@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: enable-local-variables and emacs --batch
Date: Sat, 3 Nov 2018 08:49:03 -0400 [thread overview]
Message-ID: <CAFyQvY1HpES3RqfezkOOP2-NBzi6sD4VdKPAhVTcSLPjeB8ByA@mail.gmail.com> (raw)
In-Reply-To: <CAFyQvY2EzgsbCRHqFq3DGrJwpHCF0USB6wXv91h09m+DZ5NnQA@mail.gmail.com>
On Sat, Nov 3, 2018 at 7:21 AM Kaushal Modi <kaushal.modi@gmail.com> wrote:
> Now the challenge is edebugging in --batch mode.
I don't know how to edebug in --batch, but I tried to used messages,
to get confused even more.
I couldn't reproduce the issue in that minimal example, so just added
debug messages to my actual code.
Below is the debug output while the .org file is opened in emacs --batch.
Debug code:
=====
(message "file: %S" (buffer-file-name))
(message "enable-local-variables = %S" enable-local-variables)
(message "org-hugo-section (safe-local-variable) = %S" (get
'org-hugo-section 'safe-local-variable))
(if-let* ((valid-dir-locals-found (dir-locals-find-file (buffer-file-name)))
(dir (if (listp valid-dir-locals-found)
(car valid-dir-locals-found)
valid-dir-locals-found)))
(message ".dir-locals.el file: %s"
(car
(dir-locals--all-files dir))))
(message "[ox-hugo section-path DBG] org-hugo-section: %S" org-hugo-section)
=====
Output:
=====
file: "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content-org/dir-locals/dir-locals-test.org"
enable-local-variables = t
org-hugo-section (safe-local-variable) = stringp
.dir-locals.el file:
/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content-org/dir-locals/.dir-locals.el
[ox-hugo section-path DBG] org-hugo-section: "posts"
=====
Content in ..content-org/dir-locals/.dir-locals.el:
=====
((nil . ((indent-tabs-mode . nil)
(fill-column . 70)
(sentence-end-double-space . t)))
(org-mode . ((mode . auto-fill)
(org-hugo-section . "dir-locals-test")
(org-hugo-front-matter-format . "yaml")
(org-hugo-footer . "\n\nThis text is auto inserted at
the end of the exported Markdown.")
(org-hugo-preserve-filling . nil)
(org-hugo-use-code-for-kbd . t)
(org-hugo-export-with-toc . t)
(org-hugo-export-with-section-numbers . t)
(org-hugo-export-creator-string . "Dummy creator string")
(org-hugo-date-format . "%Y-%m-%d")
(org-hugo-auto-export-on-save . t))))
=====
So my confusion ..:
1. Checked that enable-local-variables is t ("enable-local-variables =
t" in debug)
2. Checked that org-hugo-section is marked as safe if it's a string
("org-hugo-section (safe-local-variable) = stringp" in debug)
3. Checked that the correct .dir-locals.el file is applied
(".dir-locals.el file:
/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content-org/dir-locals/.dir-locals.el"
in debug)
4. See that .dir-locals.el file above and the value of
org-hugo-section -> (org-hugo-section . "dir-locals-test") <- it is
"dir-locals-test" .. and it is a string!
But still the value read of `org-hugo-section' in that .org file
buffer is "posts"!! (in debug -> [ox-hugo section-path DBG]
org-hugo-section: "posts")
So this happens only in emacs --batch, not when I open that file
manually in a regular Emacs session.
Help?
prev parent reply other threads:[~2018-11-03 12:49 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
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 [this message]
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=CAFyQvY1HpES3RqfezkOOP2-NBzi6sD4VdKPAhVTcSLPjeB8ByA@mail.gmail.com \
--to=kaushal.modi@gmail.com \
--cc=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.