From: Marcin Borkowski <mbork@mbork.pl>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Two problems with directory-local variables
Date: Mon, 17 Sep 2018 10:08:18 +0200 [thread overview]
Message-ID: <87a7ogzgul.fsf@mbork.pl> (raw)
Hi all,
I am writing a blog post about directory local variables
(http://mbork.pl/2018-09-17_Emacs_directory_variables), and I discovered
two quirks with them.
1. The docs don't seem to mention that they are processed _before_
file-local variables. (In particular, this also means before
find-file-hook, whose docstring could also mention that.)
2. More seriously, apparently the "eval" keyword doesn't work with
directory variables the way it does with file variables. The manual
says:
,----
| You can specify the variables ‘mode’, ‘eval’, and ‘unibyte’ in your
| ‘.dir-locals.el’, and they have the same meanings as they would have in
| file local variables.
`----
but I found this is not the case. This works (as a file variable):
--8<---------------cut here---------------start------------->8---
;; Local Variables:
;; eval: (message "hello")
;; End:
--8<---------------cut here---------------end--------------->8---
but this entry in .dir-locals.el does not work:
--8<---------------cut here---------------start------------->8---
((nil . ((eval '(message "hello")))))
--8<---------------cut here---------------end--------------->8---
yielding
,----
| File local-variables error: (invalid-function '(message hello))
`----
(I have no idea why the quotes are missing here, btw.)
When I type this in .dir-locals.el:
--8<---------------cut here---------------start------------->8---
((nil . ((eval (lambda () (message "hello"))))))
--8<---------------cut here---------------end--------------->8---
it works as expected.
Shouldn't the manual be updated? (If so, I can make a patch.)
Best,
--
Marcin Borkowski
http://mbork.pl
next reply other threads:[~2018-09-17 8:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-17 8:08 Marcin Borkowski [this message]
2018-09-17 9:28 ` Two problems with directory-local variables Phil Sainty
2018-09-17 15:45 ` Marcin Borkowski
2018-09-17 23:15 ` Juri Linkov
2018-09-18 0:04 ` Phil Sainty
2018-09-18 0:19 ` Juri Linkov
2018-09-18 2:15 ` Stefan Monnier
2018-09-19 22:38 ` Juri Linkov
2018-09-20 1:42 ` Drew Adams
2018-09-20 20:59 ` Juri Linkov
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a7ogzgul.fsf@mbork.pl \
--to=mbork@mbork.pl \
--cc=emacs-devel@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).