Subject: bug#44854: [PATCH] Add lexical-binding cookie to autoload files

From: Stefan Kangas <[email-masked]>
Date: Tue, 24 Nov 2020 11:34:04 -0800

Severity: wishlist

Does anyone have any objections to, or see any problems with adding the
lexical-binding cookie to autoload files, as in the attached patch?

I've tested it, and it works just fine here.
From c048a7fbfea65252ff3856b69651f7b6dd0f2682 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Tue, 20 Oct 2020 16:07:20 +0200
Subject: [PATCH] Add lexical-binding cookie to autoload files

* build-aux/update-subdirs:
* lisp/emacs-lisp/autoload.el (autoload-rubric): Add lexical-binding
cookie to generated files.
---
 lisp/emacs-lisp/autoload.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 07bda537b3..63c2082bbb 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -368,7 +368,7 @@ autoload-rubric
   (let ((basename (file-name-nondirectory file))
 	(lp (if (equal type "package") (setq type "autoloads"))))
     (concat ";;; " basename
-	    " --- automatically extracted " (or type "autoloads") "\n"
+            " --- automatically extracted " (or type "autoloads") "  -*- lexical-binding: t -*-\n"
 	    ";;\n"
 	    ";;; Code:\n\n"
 	    (if lp
-- 
2.29.2