Subject: bug#77918: 31.0.50; Warnings about missing 'lexical-binding' cookie in *Async-native-compile-log*

From: Roi Martin <[email-masked]>
Date: Sat, 19 Apr 2025 13:54:47 +0200

Eli Zaretskii <[email-masked]> writes:

> Andrea, what would you suggest as the solution for these warnings?
>
> (This was already reported as part of the discussion on emacs-devel,
> but we never finalized the solution for this aspect.)

I attached a possible fix.  Does it make sense?

>From 56319638dd5d6e6ddc628346320260e5214d3a26 Mon Sep 17 00:00:00 2001
From: Roi Martin <[email-masked]>
Date: Sat, 19 Apr 2025 13:50:52 +0200
Subject: [PATCH] ; Fix missing lexical-binding cookie warning on async
 compilation (bug#77918)

* lisp/emacs-lisp/comp-run.el (comp--run-async-workers): Fix missing
lexical-binding cookie warning on async compilation.
---
 lisp/emacs-lisp/comp-run.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/emacs-lisp/comp-run.el b/lisp/emacs-lisp/comp-run.el
index 061f1767b743..e0e00d88f83b 100644
--- a/lisp/emacs-lisp/comp-run.el
+++ b/lisp/emacs-lisp/comp-run.el
@@ -282,6 +282,7 @@ comp--run-async-workers
                                    (mapcar #'prin1-to-string expr)))
                    (_ (progn
                         (with-temp-file temp-file
+                          (insert ";;; -*- lexical-binding: t -*-\n")
                           (mapc #'insert expr-strings))
                         (comp-log "\n")
                         (mapc #'comp-log expr-strings)))
-- 
2.49.0