unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Two problems with directory-local variables
@ 2018-09-17  8:08 Marcin Borkowski
  2018-09-17  9:28 ` Phil Sainty
  0 siblings, 1 reply; 10+ messages in thread
From: Marcin Borkowski @ 2018-09-17  8:08 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-09-20 20:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-17  8:08 Two problems with directory-local variables Marcin Borkowski
2018-09-17  9:28 ` 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

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