Subject: bug#58506: Use ".dir-locals.eld" and ".dir-locals-2.eld" when they exist

From: Stefan Monnier <[email-masked]>
Date: Tue, 18 Oct 2022 09:25:26 -0400

>> I think the above is better written:
>>
>>     ((nil
>>       (tab-width . 8)
>>       (sentence-end-double-space . t)
>>       (fill-column . 70)
>>       (emacs-lisp-docstring-fill-column . 65)
>>       (vc-git-annotate-switches . "-w")
>>       (bug-reference-url-format . "https://debbugs.gnu.org/%s")
>>       (diff-add-log-use-relative-names . t))
>>      (c-mode
>>       (c-file-style . "GNU")
>>       (c-noise-macro-names . ("INLINE" "ATTRIBUTE_NO_SANITIZE_UNDEFINED" "UNINIT" "CALLBACK" "ALIGN_STACK"))
>>       (electric-quote-comment . nil)
>>       (electric-quote-string . nil)
>>       (indent-tabs-mode . t)
>>       (mode . bug-reference-prog)))
>
> So the dotted pair notation should be avoided only at the first level.

That's one way to look at it.
The other is that the dotted syntax doesn't make much sense when what
you have after the `.` is always a list.

> Then what about making it closer to the syntax of display-buffer-alist rules
> where CONDITION is passed to buffer-match-p that can match not only major-mode,
> but also a regular expression of a buffer name.

No opinion on that.  But indeed, it could be useful to specify a kind of
local `auto-mode-alist` additions.

>
>> Maybe something like:
>>
>>     (c-mode
>>      (:set c-file-style "GNU")
>>      (:set treesit-thing t)
>>      (:set odd-list (cons 3 odd-list))
>>      (:minor-mode indent-tabs-mode -1) ;; Disable
>>      (:minor-mode blink-parentheses-mode))
>
> The drawback of the current syntax is that `mode` and `eval`
> are used like variables, but really are keywords.  Using the
> keyword syntax `:` will help to resolve this ambiguity.

I think that's minor.  The fact that it only contains values rather than
(safely computable) expressions is the more problematic part.

> Also should file-local variables support the same :keyword syntax?

I don't think there's as much need for changes there, so I'd rather wait
for the dir-locals part to stabilize before trying to see if/how to move
it over to file-local variables.

        Stefan