···11+From: Lin Jian <me@linj.tech>
22+Bug: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67916
33+44+Inhibit lexical cookie warning for *-pkg.el files (bug#67916)
55+66+Users may use byte-compile-error-on-warn to turn compilation warnings
77+into errors to make sure their Emacs lisp packages are warning-free.
88+Emacs bug 67916 makes that difficult because the Emacs-generated file
99+*-pkg.el emits a compilation warning about missing lexical cookie.
1010+1111+There is an upstream patch to fix this. That patch makes Emacs also
1212+generate the needed lexical cookie when generating *-pkg.el files.
1313+However, that patch has stalled.
1414+1515+This patch takes an easier but less accurate approach by inhibiting
1616+lexical cookie warning for *-pkg.el files. Given that not all
1717+*-pkg.el files are generated by Emacs, to reduce impact, this patch
1818+also checks no-byte-compile.
1919+2020+--- a/lisp/emacs-lisp/bytecomp.el
2121++++ b/lisp/emacs-lisp/bytecomp.el
2222+@@ -2266,6 +2266,8 @@ See also `emacs-lisp-byte-compile-and-load'."
2323+ filename buffer-file-name))
2424+ ;; Don't inherit lexical-binding from caller (bug#12938).
2525+ (unless (or (local-variable-p 'lexical-binding)
2626++ (and (string-suffix-p "-pkg.el" filename)
2727++ (with-current-buffer input-buffer no-byte-compile))
2828+ bytecomp--inhibit-lexical-cookie-warning)
2929+ (let ((byte-compile-current-buffer (current-buffer)))
3030+ (displaying-byte-compile-warnings