emacs-devel
[Top][All Lists]
Advanced

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

Two problems with directory-local variables


From: Marcin Borkowski
Subject: Two problems with directory-local variables
Date: Mon, 17 Sep 2018 10:08:18 +0200
User-agent: mu4e 1.1.0; emacs 27.0.50

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



reply via email to

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