Subject: bug#17051: Order of evaluation in .dir-locals.el

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 04 Dec 2021 04:19:16 +0100

Alan Mackenzie <[email-masked]> writes:

>> When I first visit a file under that project, I get the error: "Undefined
>> style: fontforge"
>
> I don't think the order of evaluation of variables in .dir-locals.el is
> defined.  The code (in .../lisp/files.el) is not easy to understand.  It
> could well be that, for that first file, the c-file-style is being
> applied before it has been defined.

Yes, I don't think the order is well-defined -- the manual talks about
priorities:

---
If the @file{.dir-locals.el} file contains multiple different values
for a variable using different mode names or directories, the values
will be applied in an order such that the values for more specific
modes take priority over more generic modes.  Values specified under a
directory have even more priority. 
---

but I don't see anything about the order.

However, there's the .dir-locals-2.el file -- it'll be run after the
first file, so using that would solve the original use case, I think?

But I don't think there's anything here to fix here, so I'm closing this
bug report.

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