mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
fix: silence 'missing lexical-binding cookie' warnings
As of recent commits of Emacs 31, elisp files missing a "lexical-binding: t" cookie will emit this warning: Warning (files): Missing ‘lexical-binding’ cookie in "path/to/elisp/file". You can add one with ‘M-x elisp-enable-lexical-binding RET’. See ‘(elisp)Selecting Lisp Dialect’ and ‘(elisp)Converting to Lexical Binding’ for more information. You can look forward to many of these if you use any old and unmaintained elisp packages, or if you have elisp shell scripts with shebang lines (which make this warning unavoidable). This commit silences these warnings because it's poorly implemented. It's obnoxious to users and they aren't the ones that should be told this. It ought to be emitted during byte-compilation or by linters (e.g. `M-x checkdoc`) at the folks actually in a position to do something about the warning (i.e. the developers). Ref: https://lists.gnu.org/r/emacs-devel/2024-05/msg00283.html
This commit is contained in:
12
lisp/doom.el
12
lisp/doom.el
@ -665,6 +665,12 @@ to `doom-profile-cache-dir' instead, so it can be safely cleaned up as part of
|
||||
;; still aliases them fine regardless.
|
||||
(setq warning-suppress-types '((defvaralias) (lexical-binding)))
|
||||
|
||||
;; As some point in 31+, Emacs began spamming the user with warnings about
|
||||
;; missing `lexical-binding' cookies in elisp files that you are unlikely to
|
||||
;; have any direct control over (e.g. package files, data lisp files, and elisp
|
||||
;; shell scripts). This shuts it up.
|
||||
(setq warning-inhibit-types '((files missing-lexbind-cookie)))
|
||||
|
||||
;; Reduce debug output unless we've asked for it.
|
||||
(setq debug-on-error init-file-debug
|
||||
jka-compr-verbose init-file-debug)
|
||||
@ -880,12 +886,6 @@ appropriately against `noninteractive' or the `cli' context."
|
||||
;; the session is complicated by user config and packages.
|
||||
(doom-run-hooks 'doom-before-init-hook)
|
||||
|
||||
;; HACK: Later versions of Emacs 30 emit warnings about missing
|
||||
;; lexical-bindings directives at the top of loaded files. This is a good
|
||||
;; thing, but it inundates users with unactionable warnings (from old
|
||||
;; packages or internal subdirs.el files), which aren't useful.
|
||||
(cl-callf2 assq-delete-all 'lexical-binding delayed-warnings-list)
|
||||
|
||||
;; HACK: Ensure OS checks are as fast as possible (given their ubiquity).
|
||||
(setq features (cons :system (delq :system features)))
|
||||
|
||||
|
Reference in New Issue
Block a user