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


Message #77 received at 58506 <at> debbugs.gnu.org (full text, mbox):

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

> As Philip points out, "hard to write" is circumvented by
> `add-dir-local-variable`.

My ever-reliable statistics team is informing me that 99.74% of
.dir-locals files are written by hand.

> We should either make it use a proper subset of ELisp, or make it use
> a syntax that's sufficiently different.
>
> 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))

Yes, that's much better than my initial suggestion.  But I like the
safe-lisp approach better.

> [ I dropped the "set-early" because I still haven't heard any good
>   reason why we'd need that nor what that would really mean (e.g. how it
>   could be implemented).  ]

Some major modes react to variables to change how they work.  So
you'd say

(setq org-thingamabob-syntax-version 2)
(org-thingamabob-mode)

And this has to be set before the mode is called, because the mode is
very expensive and re-interpreting the file afterwards is ungood.

>> `safep' would have to be a bit adjusted -- a `safep' for `odd-list'
>> would be (cl-every #'oddp) etc.
>
> Sorry, I don't know what problem you're alluding to.
> Why would `safep` need to be adjusted?

It's not necessary, but it'd be nice to be able to say "this element is
safe to add to the list" instead of saying "after adding this element to
the list, the resulting list is safe".




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

Previous Next


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