Files
nixpkgs/pkgs/applications/editors/emacs/inhibit-lexical-cookie-warning-67916-30.patch
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

31 lines
1.4 KiB
Diff

From: Lin Jian <me@linj.tech>
Bug: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67916
Inhibit lexical cookie warning for *-pkg.el files (bug#67916)
Users may use byte-compile-error-on-warn to turn compilation warnings
into errors to make sure their Emacs lisp packages are warning-free.
Emacs bug 67916 makes that difficult because the Emacs-generated file
*-pkg.el emits a compilation warning about missing lexical cookie.
There is an upstream patch to fix this. That patch makes Emacs also
generate the needed lexical cookie when generating *-pkg.el files.
However, that patch has stalled.
This patch takes an easier but less accurate approach by inhibiting
lexical cookie warning for *-pkg.el files. Given that not all
*-pkg.el files are generated by Emacs, to reduce impact, this patch
also checks no-byte-compile.
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2266,6 +2266,8 @@ 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)
+ (and (string-suffix-p "-pkg.el" filename)
+ (with-current-buffer input-buffer no-byte-compile))
bytecomp--inhibit-lexical-cookie-warning)
(let ((byte-compile-current-buffer (current-buffer)))
(displaying-byte-compile-warnings