fix: file-missing errors while trying to build packages

This is caused by a bug in recent builds of Emacs 29, where
`loaddefs-generate` will activate emacs-lisp-mode to read a package's
autoloads, but does so without suppressing its mode hooks. Other
packages may add functions to this hook from their autoloads (like
overseer.el does). Calling these functions will initiate a chain
reaction where other packages will be loaded (plus their dependencies),
but aren't guaranteed to be available so early in the bootstrap process.
The result are file-missing errors about seemingly unrelated packages,
like pkg-info or dash.

Ref: emacs-mirror/emacs@0d383b592c
Fix: https://discourse.doomemacs.org/t/3149
This commit is contained in:
Henrik Lissner 2022-09-10 12:38:53 +02:00
parent 96ae3f1b04
commit 7e931ec586
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -116,6 +116,19 @@ uses a straight or package.el command directly).")
(append (apply fn args) ; lockfiles still take priority
(doom-package-pinned-list)))
;; HACK: This fixes an issue present in recent builds of Emacs 29. See
;; emacs-mirror/emacs@0d383b592c2f. Straight.el uses `loaddefs-generate' if it
;; is available, which activates `emacs-lisp-mode' to read autoloads files,
;; but does so without suppressing its hooks. Some packages (like overseer)
;; add hooks to `emacs-lisp-mode-hook' in their autoloads, and once triggered,
;; they will try to load their dependencies (like dash or pkg-info), causing
;; file errors.
;; REVIEW: Report this upstream.
(defadvice! doom--fix-loaddefs-generate--parse-file-a (fn &rest args)
:around #'loaddefs-generate--parse-file
(let (emacs-lisp-mode-hook)
(apply fn args)))
;;
;;; native-comp