unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: 58506@debbugs.gnu.org, philipk@posteo.net,
	monnier@iro.umontreal.ca, juri@linkov.net
Subject: bug#58506: Use ".dir-locals.eld" and ".dir-locals-2.eld" when they exist
Date: Fri, 14 Oct 2022 13:38:27 +0300	[thread overview]
Message-ID: <83pmeu8zbw.fsf@gnu.org> (raw)
In-Reply-To: <CADwFkmnwXyey8CA3EdyczSydMZME2rJB6jh0WFh8S5BYV4Lpcw@mail.gmail.com> (message from Stefan Kangas on Fri, 14 Oct 2022 11:22:23 +0200)

> Cc: Juri Linkov <juri@linkov.net>, Philip Kaludercic <philipk@posteo.net>,
>  Stefan Monnier <monnier@iro.umontreal.ca>
> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Fri, 14 Oct 2022 11:22:23 +0200
> 
> Severity: wishlist
> 
> [Spun out from Bug#58486.]
> 
> Juri Linkov <juri@linkov.net> writes:
> 
> > It's already handled by auto-mode-alist:
> >
> >   (defvar auto-mode-alist
> >        ...
> >        ;; .dir-locals.el is not really Elisp.  Could use the
> >        ;; `dir-locals-file' constant if it weren't defined below.
> >        ("\\.dir-locals\\(?:-2\\)?\\.el\\'" . lisp-data-mode)
> 
> It's nice if we can use the "*.eld" extension for files that are not
> supposed to be executed.  But it's hard to just change that outright, as
> a file ".dir-locals.eld" won't be used on old versions of Emacs.
> 
> So how about doing something like the below, as a future compatibility
> patch?  Then, in some undefined future version, we can consider creating
> ".dir-locals.eld" files by default, instead.
> 
> diff --git a/lisp/files.el b/lisp/files.el
> index 94d110f0b7..bfd1e5e8e1 100644
> --- a/lisp/files.el
> +++ b/lisp/files.el
> @@ -4403,11 +4403,14 @@ dir-locals--all-files
>                                          (dosified-file-name dir-locals-file)
>                                        dir-locals-file)
>                                      directory))
> -           (file-2 (when (string-match "\\.el\\'" file-1)
> +           (is-el (string-match (rx ".el" eos) file-1))
> +           (file-2 (when is-el
>                       (replace-match "-2.el" t nil file-1)))
>            (out nil))
>        ;; The order here is important.
> -      (dolist (f (list file-2 file-1))
> +      ;; Support *.eld files, too.
> +      (dolist (f (list (and is-el (concat file-2 "d")) file-2
> +                       (and is-el (concat file-1 "d")) file-1))

This conses 2 strings, which is a pity, because this code is called a
lot.  Can this be done without so much consing for such a simple job?





  reply	other threads:[~2022-10-14 10:38 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-13  9:05 bug#58486: [PATCH] Prevent .dir-locals.el from being byte-compiled Philip Kaludercic
2022-10-13 14:20 ` Stefan Kangas
2022-10-13 14:32   ` Philip Kaludercic
2022-10-13 14:51     ` Stefan Kangas
2022-10-13 17:18   ` Juri Linkov
2022-10-13 19:11     ` Philip Kaludercic
2022-10-14  9:22     ` bug#58506: Use ".dir-locals.eld" and ".dir-locals-2.eld" when they exist Stefan Kangas
2022-10-14 10:38       ` Eli Zaretskii [this message]
2022-10-14 12:36         ` Stefan Kangas
2022-10-14 11:25       ` Lars Ingebrigtsen
2022-10-14 12:36         ` Stefan Kangas
2022-10-14 13:04         ` Robert Pluim
2022-10-14 13:10           ` Lars Ingebrigtsen
2022-10-14 13:23             ` Robert Pluim
2022-10-14 13:29               ` Lars Ingebrigtsen
2022-10-14 13:41                 ` Robert Pluim
2022-10-14 15:13           ` Philip Kaludercic
2022-10-15  9:18             ` Lars Ingebrigtsen
2022-10-15  9:38               ` Philip Kaludercic
2022-10-15  9:42                 ` Lars Ingebrigtsen
2022-10-15 10:00                   ` Lars Ingebrigtsen
2022-10-15 11:35                   ` Philip Kaludercic
2022-10-15 13:56                     ` Lars Ingebrigtsen
2022-10-15 15:12                       ` Philip Kaludercic
2022-10-15 16:22                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-16  8:39                         ` Lars Ingebrigtsen
2022-10-15 10:05                 ` Stefan Kangas
2022-10-15 15:19               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-16  8:47                 ` Lars Ingebrigtsen
2022-10-16  9:34                   ` Philip Kaludercic
2022-10-16  9:43                     ` Lars Ingebrigtsen
2022-10-16 13:38                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-16 13:44                     ` Lars Ingebrigtsen
2022-10-18 13:30                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-18  7:28                 ` Juri Linkov
2022-10-18 13:25                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-14 13:38         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-14 15:07       ` Philip Kaludercic
2022-10-14 16:32     ` bug#58486: [PATCH] Prevent .dir-locals.el from being byte-compiled Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-15 19:16       ` Juri Linkov
2022-10-16 13:17         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-13 18:02 ` Lars Ingebrigtsen
2022-10-14 18:14   ` Philip Kaludercic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83pmeu8zbw.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=58506@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=monnier@iro.umontreal.ca \
    --cc=philipk@posteo.net \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).