From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#58506: Use ".dir-locals.eld" and ".dir-locals-2.eld" when they exist Date: Sun, 16 Oct 2022 09:34:48 +0000 Message-ID: <87czas5cxz.fsf@posteo.net> References: <87sfjsgkl4.fsf@posteo.net> <865ygn4pno.fsf@mail.linkov.net> <87y1tiabq5.fsf@gnus.org> <87czauzhch.fsf@gmail.com> <87k052h1zt.fsf@posteo.net> <87ilkl78cd.fsf@gnus.org> <875ygk2lzz.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2121"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58506@debbugs.gnu.org, Robert Pluim , Stefan Kangas , Stefan Monnier , Juri Linkov To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 16 11:35:39 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ok03X-0000H9-CX for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 16 Oct 2022 11:35:39 +0200 Original-Received: from localhost ([::1]:46072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ok03V-0003Sx-Ra for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 16 Oct 2022 05:35:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ok02w-0003Sb-SI for bug-gnu-emacs@gnu.org; Sun, 16 Oct 2022 05:35:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44331) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ok02w-0007Nq-Jq for bug-gnu-emacs@gnu.org; Sun, 16 Oct 2022 05:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ok02w-0000vW-6X for bug-gnu-emacs@gnu.org; Sun, 16 Oct 2022 05:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 16 Oct 2022 09:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58506 X-GNU-PR-Package: emacs Original-Received: via spool by 58506-submit@debbugs.gnu.org id=B58506.16659128983547 (code B ref 58506); Sun, 16 Oct 2022 09:35:02 +0000 Original-Received: (at 58506) by debbugs.gnu.org; 16 Oct 2022 09:34:58 +0000 Original-Received: from localhost ([127.0.0.1]:43409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ok02s-0000v8-6a for submit@debbugs.gnu.org; Sun, 16 Oct 2022 05:34:58 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:51945) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ok02o-0000us-Vr for 58506@debbugs.gnu.org; Sun, 16 Oct 2022 05:34:56 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 7BA81240103 for <58506@debbugs.gnu.org>; Sun, 16 Oct 2022 11:34:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665912889; bh=ZmLklNrGNjAE3Hs2GwUNWKbm6lVEpijVJptNKNS62wA=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=SbXpak4UVvdReOYIk19nIp6VTrrEKCE8kxdK1OAmi7R4upEGFRFr2jqIfjjEwzLd3 QwxvsT1bIFguHrVWwhs+FAy7kWn/ke5I1jEIQgLe2GyTgYst1Toq8FMHmXIvkJcDo3 fRCR7o9PMnGzfgQnaIWchICFGPj1Mzn8FotD/l+I3UAkdcV9yDcTg2UZJWJRa+3lt3 bY/8uRY+vdDErOv4Z/TilJrgd2o/TgUkSdTqMP8/e37aZ8dxVCdz2bwtWAHZyPkQfi wRaBbvJGds5S5z1tkIvvDRpR3jOkMNJU2mko0r8AAUdlSLBlZS+JxA9vNYN8Oea9aI IX4LE9IX1Vt5A== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Mqw2J4xzvz9rxF; Sun, 16 Oct 2022 11:34:48 +0200 (CEST) In-Reply-To: <875ygk2lzz.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 16 Oct 2022 10:47:28 +0200") Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:245615 Archived-At: Lars Ingebrigtsen writes: > Stefan Monnier 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. Really? I guess by virtue of participating in this very discussion I'm not the average Emacs user, but I'd be surprised if `add-dir-local-variable' is that unknown. >> 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)) And I assume that if you don't wrap the block in a (foo-mode ...) construct, that the settings will apply to all modes, right? > Yes, that's much better than my initial suggestion. But I like the > safe-lisp approach better. ... why not both? I can imagine that safe-lisp will take a while before it becomes usable, just because something like `safe-eval-p' has to be quite exhaustive, and at the very least handle all special forms. Elisp isn't a Scheme so that means that a number of methods have to be implemented... Meanwhile .dir-locals.eld with Stefan's syntax seems like a good improvement over the current syntax -- especially if you are right about how many people write these files from hand. >> [ 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". I have seen a lot of packages that either forget or don't bother to specify safe values even if they are applicable. Making it easier to do so could help motivate maintainers to specify these.