Subject: bug#70068: [PATCH] Don't warn about lexical binding in lisp-interaction-mode

From: Philip Kaludercic <[email-masked]>
Date: Fri, 29 Mar 2024 11:31:49 +0000

The main intention here is to avoid underlining the first line in the
*scratch* buffer when flymake is enabled:

>From 714cba0f576566e39b7ffeb77b8f9b80bb3003ff Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <[email-masked]>
Date: Fri, 29 Mar 2024 12:30:59 +0100
Subject: [PATCH] Don't warn about lexical binding in lisp-interaction-mode

* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Suppress
warning in 'lisp-interaction-mode' buffers like the *scratch*
buffer.
---
 lisp/emacs-lisp/bytecomp.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 7af568cfe34..e04df8f9ade 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2234,7 +2234,8 @@ byte-compile-file
         (setq buffer-read-only nil
               filename buffer-file-name))
       ;; Don't inherit lexical-binding from caller (bug#12938).
-      (unless (local-variable-p 'lexical-binding)
+      (unless (or (local-variable-p 'lexical-binding)
+                  (derived-mode-p 'lisp-interaction-mode))
         (let ((byte-compile-current-buffer (current-buffer)))
           (displaying-byte-compile-warnings
            (byte-compile-warn-x
-- 
2.44.0

-- 
	Philip Kaludercic on peregrine