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)
This commit is contained in:
Philip Kaludercic 2026-04-26 23:18:51 +02:00
parent 475bb02345
commit 52769368d7
No known key found for this signature in database

View file

@ -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