Subject: [PATCH] Prevent .dir-locals.el from being byte-compiled
From: Philip Kaludercic <[email-masked]>
To: [email-masked]
Date: Thu, 13 Oct 2022 09:05:11 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

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'

From 8bf2e39c36a66df7e415800caa77c9116648effb Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <[email-masked]>
Date: Wed, 5 Oct 2022 19:45:27 +0200
Subject: [PATCH] Prevent .dir-locals.el from being byte-compiled

* lisp/files-x.el (modify-dir-local-variable): Add a 'no-byte-compile'
file local variable when generating a .dir-locals.el file.
---
 lisp/files-x.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/files-x.el b/lisp/files-x.el
index da1e44e250..f6d5d6cc27 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -489,7 +489,7 @@ modify-dir-local-variable
                               dir-locals-directory-cache))
 
       ;; Insert modified alist of directory-local variables.
-      (insert ";;; Directory Local Variables\n")
+      (insert ";;; Directory Local Variables            -*- no-byte-compile: t -*-\n")
       (insert ";;; For more information see (info \"(emacs) Directory Variables\")\n\n")
       (princ (dir-locals-to-string
               (sort variables
-- 
2.37.3