From 52769368d7ec23421cde757a0b3dc7dcb4e35933 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 26 Apr 2026 23:18:51 +0200 Subject: [PATCH] Do not warn about 'lexical-binding' if buffer is not compiled * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Check 'no-byte-compile' before issuing a warning. This prevents false-positives when running into .dir-locals.el or -pkg.el files. (Bug#80352) --- lisp/emacs-lisp/bytecomp.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index aadfc4c335a..b1875dc2bcf 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2270,6 +2270,7 @@ See also `emacs-lisp-byte-compile-and-load'." filename buffer-file-name)) ;; Don't inherit lexical-binding from caller (bug#12938). (unless (or (local-variable-p 'lexical-binding) + no-byte-compile bytecomp--inhibit-lexical-cookie-warning) (let ((byte-compile-current-buffer (current-buffer))) (displaying-byte-compile-warnings