From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#58506: Use ".dir-locals.eld" and ".dir-locals-2.eld" when they exist Date: Tue, 18 Oct 2022 10:28:27 +0300 Organization: LINKOV.NET Message-ID: <86h701pp45.fsf@mail.linkov.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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39792"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 58506@debbugs.gnu.org, Lars Ingebrigtsen , Stefan Kangas , Philip Kaludercic , Robert Pluim To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 18 09:38:43 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 1okhBT-000A5P-CR for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 18 Oct 2022 09:38:43 +0200 Original-Received: from localhost ([::1]:32960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okhBR-0000zJ-TX for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 18 Oct 2022 03:38:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okh8t-0000sv-BF for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 03:36:16 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51957) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okh8s-0002vz-Ah for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 03:36:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1okh8s-0005Ip-5D for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 03:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 18 Oct 2022 07:36: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.166607854720363 (code B ref 58506); Tue, 18 Oct 2022 07:36:02 +0000 Original-Received: (at 58506) by debbugs.gnu.org; 18 Oct 2022 07:35:47 +0000 Original-Received: from localhost ([127.0.0.1]:51035 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okh8c-0005IL-PD for submit@debbugs.gnu.org; Tue, 18 Oct 2022 03:35:47 -0400 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:47419) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okh8a-0005I6-Lh for 58506@debbugs.gnu.org; Tue, 18 Oct 2022 03:35:45 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 7562D2000F; Tue, 18 Oct 2022 07:35:34 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Sat, 15 Oct 2022 11:19:09 -0400") 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:245779 Archived-At: > I think the above is better written: > > ((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))) So the dotted pair notation should be avoided only at the first level. Then what about making it closer to the syntax of display-buffer-alist rules where CONDITION is passed to buffer-match-p that can match not only major-mode, but also a regular expression of a buffer name. And display-buffer-alist's ACTION alist already looks like dir-locals's alist. > 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)) The drawback of the current syntax is that `mode` and `eval` are used like variables, but really are keywords. Using the keyword syntax `:` will help to resolve this ambiguity. Then for backwards-compatibility dir-locals could support both the current dotted pairs and new :keyword syntax, where unrecognized keywords are simply ignored in older versions. Also should file-local variables support the same :keyword syntax?