bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#44066: 27.1; Values ignored when using .dir-locals.el and .dir-local


From: Jacob First
Subject: bug#44066: 27.1; Values ignored when using .dir-locals.el and .dir-locals-2.el together
Date: Mon, 19 Oct 2020 16:46:17 -0400

Hi,

> Anyway, here's what's happening if you have two .dir-locals files:
>
> (setq variables '((nil (eval setq var1 'foo) (eval setq var2 'bar))))
> (setq newvars '((nil (eval setq var3 'baz) (eval setq var4 'qux))))
> 
> Then this is run:
> 
> (map-merge-with 'list (lambda (a b) (map-merge 'list a b))
>                                     variables
>                                     newvars)
> => ((nil (eval setq var4 'qux) (eval setq var2 'bar)))

Thanks!

> But...  is this syntax even allowed?  Does it work in the
> single-dir-locals-file case by accident?

Are you asking if multiple `eval' are allowed per file? I'm pretty sure
they are; at least, I've seen them used regularly and can't find a
restriction in the manual. In any case, there's still a problem when
each list contains only a single `eval':

(setq variables '((nil (eval setq var1 'foo))))
(setq newvars '((nil (eval setq var3 'baz))))

(map-merge-with 'list (lambda (a b)
                        (map-merge 'list a b))
                variables
                newvars)

=> ((nil (eval setq var3 'baz)))

Presumably (setq var1 'foo) should also be evaluated, right?

Another thing that might imply support for multiple `eval' is intended:
if in .dir-locals.el I have

((nil . ((eval . (setq var1 'foo))))
 (scheme-mode . ((eval . (setq var2 'bar)))))

then when I open a file in Scheme mode, both var1 and var2 are set
rather than the Scheme setting overriding, even though for normal
variables, the more specific setting is supposed to take precedence.
This is getting a bit speculative though.





reply via email to

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