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: Lars Ingebrigtsen
Subject: bug#44066: 27.1; Values ignored when using .dir-locals.el and .dir-locals-2.el together
Date: Mon, 19 Oct 2020 11:44:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jacob First <jacob.first@member.fsf.org> writes:

> To reproduce, first create a directory with 3 files with the filenames
> and the contents listed below:
>
> = file.txt =
> test file
>
> = .dir-locals.el =
> ((nil . ((eval . (setq var1 'foo)) (eval . (setq var2 'bar)))))
>
> = .dir-locals-2.el =
> ((nil . ((eval . (setq var3 'baz)) (eval . (setq var4 'qux)))))

This was fun to debug, because there's so much caching going on that...
well.

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

If there's only a single .dir-locals file, nothing is merged and the
form is returned as is.

This certainly seems like a bug, and it's present in Emacs 26, too
(which is the earliest one I have here).

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

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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