GNU bug report logs - #58486
[PATCH] Prevent .dir-locals.el from being byte-compiled

Previous Next

Package: emacs;

Reported by: Philip Kaludercic <philipk <at> posteo.net>

Date: Thu, 13 Oct 2022 09:06:01 UTC

Severity: wishlist

Tags: patch

Done: Philip Kaludercic <philipk <at> posteo.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 58486 in the body.
You can then email your comments to 58486 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#58486; Package emacs. (Thu, 13 Oct 2022 09:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Philip Kaludercic <philipk <at> posteo.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 13 Oct 2022 09:06:02 GMT) Full text and rfc822 format available.

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

From: Philip Kaludercic <philipk <at> posteo.net>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Prevent .dir-locals.el from being byte-compiled
Date: Thu, 13 Oct 2022 09:05:11 +0000
[Message part 1 (text/plain, inline)]
Tags: patch


When selecting a number of .el files in Dired and byte-compiling them
I'll usually also select a .dir-locals.el file that won't compile.
Would annotating them as non-byte-compilable files be sensible?


In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.34, cairo version 1.17.6) of 2022-10-13 built on rhea
Repository revision: 36505800b5a0c8d7b4af5ceb54483cfdfdbf6925
Repository branch: local
System Description: Fedora Linux 36 (Workstation Edition)

Configured using:
 'configure --with-pgtk --with-imagemagick'

[0001-Prevent-.dir-locals.el-from-being-byte-compiled.patch (text/patch, attachment)]

Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 13 Oct 2022 13:48:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58486; Package emacs. (Thu, 13 Oct 2022 14:21:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Philip Kaludercic <philipk <at> posteo.net>, 58486 <at> debbugs.gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#58486: [PATCH] Prevent .dir-locals.el from being byte-compiled
Date: Thu, 13 Oct 2022 16:20:03 +0200
Philip Kaludercic <philipk <at> posteo.net> writes:

> When selecting a number of .el files in Dired and byte-compiling them
> I'll usually also select a .dir-locals.el file that won't compile.
> Would annotating them as non-byte-compilable files be sensible?

Makes sense to me, FWIW.  Though Stefan M might point out that these
files should actually be called ".dir-locals.eld".  Which, BTW, we
should probably add support for.  And "*.eld" files should never be
compiled, I think?

(Don't forget to add the cookie to our .dir-locals.el as well.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58486; Package emacs. (Thu, 13 Oct 2022 14:33:02 GMT) Full text and rfc822 format available.

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

From: Philip Kaludercic <philipk <at> posteo.net>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 58486 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#58486: [PATCH] Prevent .dir-locals.el from being byte-compiled
Date: Thu, 13 Oct 2022 14:32:31 +0000
Stefan Kangas <stefankangas <at> gmail.com> writes:

> Philip Kaludercic <philipk <at> posteo.net> writes:
>
>> When selecting a number of .el files in Dired and byte-compiling them
>> I'll usually also select a .dir-locals.el file that won't compile.
>> Would annotating them as non-byte-compilable files be sensible?
>
> Makes sense to me, FWIW.  Though Stefan M might point out that these
> files should actually be called ".dir-locals.eld".  Which, BTW, we
> should probably add support for.  And "*.eld" files should never be
> compiled, I think?

AFAIR this was not done to avoid newer versions of Emacs creating
.dir-locals.eld files that older versions of Emacs won't notice.

> (Don't forget to add the cookie to our .dir-locals.el as well.)

Good point, will do.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58486; Package emacs. (Thu, 13 Oct 2022 14:52:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Philip Kaludercic <philipk <at> posteo.net>
Cc: 58486 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#58486: [PATCH] Prevent .dir-locals.el from being byte-compiled
Date: Thu, 13 Oct 2022 16:51:27 +0200
Philip Kaludercic <philipk <at> posteo.net> writes:

> AFAIR this was not done to avoid newer versions of Emacs creating
> .dir-locals.eld files that older versions of Emacs won't notice.

If we add support to read them when they exist in Emacs 29, it will be
safe to start creating them in some future version 30+.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58486; Package emacs. (Thu, 13 Oct 2022 17:36:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 58486 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#58486: [PATCH] Prevent .dir-locals.el from being byte-compiled
Date: Thu, 13 Oct 2022 20:18:43 +0300
>> When selecting a number of .el files in Dired and byte-compiling them
>> I'll usually also select a .dir-locals.el file that won't compile.
>> Would annotating them as non-byte-compilable files be sensible?
>
> Makes sense to me, FWIW.  Though Stefan M might point out that these
> files should actually be called ".dir-locals.eld".  Which, BTW, we
> should probably add support for.  And "*.eld" files should never be
> compiled, I think?

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)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58486; Package emacs. (Thu, 13 Oct 2022 18:04:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Philip Kaludercic <philipk <at> posteo.net>
Cc: 58486 <at> debbugs.gnu.org
Subject: Re: bug#58486: [PATCH] Prevent .dir-locals.el from being byte-compiled
Date: Thu, 13 Oct 2022 20:02:52 +0200
Philip Kaludercic <philipk <at> posteo.net> writes:

> * lisp/files-x.el (modify-dir-local-variable): Add a 'no-byte-compile'
> file local variable when generating a .dir-locals.el file.

Looks good to me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58486; Package emacs. (Thu, 13 Oct 2022 19:12:02 GMT) Full text and rfc822 format available.

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

From: Philip Kaludercic <philipk <at> posteo.net>
To: Juri Linkov <juri <at> linkov.net>
Cc: 58486 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#58486: [PATCH] Prevent .dir-locals.el from being byte-compiled
Date: Thu, 13 Oct 2022 19:11:12 +0000
Juri Linkov <juri <at> linkov.net> writes:

>>> When selecting a number of .el files in Dired and byte-compiling them
>>> I'll usually also select a .dir-locals.el file that won't compile.
>>> Would annotating them as non-byte-compilable files be sensible?
>>
>> Makes sense to me, FWIW.  Though Stefan M might point out that these
>> files should actually be called ".dir-locals.eld".  Which, BTW, we
>> should probably add support for.  And "*.eld" files should never be
>> compiled, I think?
>
> 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)

Yes, but this is not related to the situation I mentioned with Dired.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58486; Package emacs. (Fri, 14 Oct 2022 16:33:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> linkov.net>
Cc: 58486 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>,
 Stefan Kangas <stefan <at> marxist.se>
Subject: Re: bug#58486: [PATCH] Prevent .dir-locals.el from being byte-compiled
Date: Fri, 14 Oct 2022 12:32:12 -0400
>>> When selecting a number of .el files in Dired and byte-compiling them
>>> I'll usually also select a .dir-locals.el file that won't compile.
>>> Would annotating them as non-byte-compilable files be sensible?
>>
>> Makes sense to me, FWIW.  Though Stefan M might point out that these
>> files should actually be called ".dir-locals.eld".  Which, BTW, we
>> should probably add support for.  And "*.eld" files should never be
>> compiled, I think?
>
> 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)

To stay in the spirit of bug#58075, if we consider the major mode
specified in `auto-mode-alist` (and `mode:` cookies) as a proxy for
"file type", maybe we should arrange to try and avoid byte-compiling
those `.el` files whose major mode is `lisp-data-mode` (or: is not
`emacs-lisp-mode`)?


        Stefan





Reply sent to Philip Kaludercic <philipk <at> posteo.net>:
You have taken responsibility. (Fri, 14 Oct 2022 18:15:01 GMT) Full text and rfc822 format available.

Notification sent to Philip Kaludercic <philipk <at> posteo.net>:
bug acknowledged by developer. (Fri, 14 Oct 2022 18:15:02 GMT) Full text and rfc822 format available.

Message #33 received at 58486-done <at> debbugs.gnu.org (full text, mbox):

From: Philip Kaludercic <philipk <at> posteo.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 58486-done <at> debbugs.gnu.org
Subject: Re: bug#58486: [PATCH] Prevent .dir-locals.el from being byte-compiled
Date: Fri, 14 Oct 2022 18:14:09 +0000
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Philip Kaludercic <philipk <at> posteo.net> writes:
>
>> * lisp/files-x.el (modify-dir-local-variable): Add a 'no-byte-compile'
>> file local variable when generating a .dir-locals.el file.
>
> Looks good to me.

It has been pushed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58486; Package emacs. (Sat, 15 Oct 2022 19:22:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 58486 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>,
 Stefan Kangas <stefan <at> marxist.se>
Subject: Re: bug#58486: [PATCH] Prevent .dir-locals.el from being byte-compiled
Date: Sat, 15 Oct 2022 22:16:01 +0300
>>   (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)
>
> To stay in the spirit of bug#58075, if we consider the major mode
> specified in `auto-mode-alist` (and `mode:` cookies) as a proxy for
> "file type", maybe we should arrange to try and avoid byte-compiling
> those `.el` files whose major mode is `lisp-data-mode` (or: is not
> `emacs-lisp-mode`)?

I don't know if such case is possible that auto-mode-alist specifies
lisp-data-mode for a file type to avoid byte-compiling, but
some file of that type needs to override its file type's default
by using a cookie `no-byte-compile: nil`?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58486; Package emacs. (Sun, 16 Oct 2022 13:18:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> linkov.net>
Cc: 58486 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>,
 Stefan Kangas <stefan <at> marxist.se>
Subject: Re: bug#58486: [PATCH] Prevent .dir-locals.el from being byte-compiled
Date: Sun, 16 Oct 2022 09:17:49 -0400
>> To stay in the spirit of bug#58075, if we consider the major mode
>> specified in `auto-mode-alist` (and `mode:` cookies) as a proxy for
>> "file type", maybe we should arrange to try and avoid byte-compiling
>> those `.el` files whose major mode is `lisp-data-mode` (or: is not
>> `emacs-lisp-mode`)?
>
> I don't know if such case is possible that auto-mode-alist specifies
> lisp-data-mode for a file type to avoid byte-compiling, but
> some file of that type needs to override its file type's default
> by using a cookie `no-byte-compile: nil`?

I don't understand what you're saying.  The auto-mode-alist's purpose is
not "to avoid byte-compiling" but to indicate what kind of content is to
be found in the file.  And all I'm suggesting is that we should take
advantage of that info in more places, for example when we decide
whether to byte-compile something.


        Stefan





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 14 Nov 2022 12:24:10 GMT) Full text and rfc822 format available.

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

Previous Next


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