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: Stefan Monnier
Subject: bug#58506: Use ".dir-locals.eld" and ".dir-locals-2.eld" when they exist
Date: Sun, 16 Oct 2022 09:38:48 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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

We've been solving this problem for the last 30 years without
introducing a new kind of "set before mode", so I don't understand
your example.

If `org-thingamabob-mode` is a major mode, then it starts with
`kill-all-local-variables`, so either you mark
`org-thingamabob-syntax-version` as persistent-local or you're screwed
from the outset (you can try some convoluted hack using
`change-major-mode-hook` but it's gonna be ugly).

OTOH using `:after-hook` or `hack-local-variables-hook` works right now
without very much effort.

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

So: delay the expensive part.  It's usually pretty easy, and most of the
time it's a good idea for all kinds of other reasons.

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

Ah, I see.  My intuition is YAGNI but I haven't thought too much
about it.


        Stefan






reply via email to

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