GNU bug report logs - #58506
Use ".dir-locals.eld" and ".dir-locals-2.eld" when they exist

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefankangas <at> gmail.com>

Date: Fri, 14 Oct 2022 09:23:01 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 58506 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>, Stefan Kangas <stefan <at> marxist.se>, Philip Kaludercic <philipk <at> posteo.net>, Robert Pluim <rpluim <at> gmail.com>
Subject: bug#58506: Use ".dir-locals.eld" and ".dir-locals-2.eld" when they exist
Date: Tue, 18 Oct 2022 10:28:27 +0300
> 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.

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.  And display-buffer-alist's
ACTION alist already looks like dir-locals's alist.

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

Then for backwards-compatibility dir-locals could support both
the current dotted pairs and new :keyword syntax, where unrecognized
keywords are simply ignored in older versions.

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




This bug report was last modified 2 years and 243 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.