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





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

Previous Next


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