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

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

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


From: Lars Ingebrigtsen
Subject: bug#58506: Use ".dir-locals.eld" and ".dir-locals-2.eld" when they exist
Date: Sat, 15 Oct 2022 11:18:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Philip Kaludercic <philipk@posteo.net> writes:

> What I would like to see if some kind of extensibility in the syntax.
> Perhaps using methods.  I have often seen projects using `eval' just
> because the options they are setting are not trivial assignments, but
> conventional modifications like prepending an item to a list or setting
> a symbol property (check out the .dir-locals.el for Guix if you want to
> see a massive "Do you want to accept all these variables" prompt).

Yes, exactly -- people have to resort to using `eval' (which is
something people should use as little as possible) because our syntax
doesn't allow for simple things like adding values to a list.

Post-mode variables and list concatenation are two things we'd like to
have, but I'm sure there's a whole bunch of stuff people will come up
with if the syntax allowed for (safe) extensions.

I don't know what the new syntax would look like -- the current syntax
is, er, very implementation-friendly and user-hostile.  I.e., it's easy
for Emacs to parse, and difficult for people to write:

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

Perhaps a more imperative style would be nice.  Err...  something
like...

(in-mode c-mode
  (set c-file-style "GNU")
  (set-early treesit-thing t)
  (add-to-list odd-list 3)
  (minor-mode indent-tabs-mode)
  (minor-mode blink-parentheses-mode))

`safep' would have to be a bit adjusted -- a `safep' for `odd-list'
would be (cl-every #'oddp) etc.

And we'd make the parser backwards/forwards compatible -- i.e., elements
that are unknown to the Emacs version running would just be ignored.






reply via email to

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