Skip to content

Commit 7e931ec

Browse files
committed
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@0d383b592c2f Fix: https://discourse.doomemacs.org/t/3149
1 parent 96ae3f1 commit 7e931ec

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lisp/doom-packages.el

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,19 @@ uses a straight or package.el command directly).")
116116
(append (apply fn args) ; lockfiles still take priority
117117
(doom-package-pinned-list)))
118118

119+
;; HACK: This fixes an issue present in recent builds of Emacs 29. See
120+
;; emacs-mirror/emacs@0d383b592c2f. Straight.el uses `loaddefs-generate' if it
121+
;; is available, which activates `emacs-lisp-mode' to read autoloads files,
122+
;; but does so without suppressing its hooks. Some packages (like overseer)
123+
;; add hooks to `emacs-lisp-mode-hook' in their autoloads, and once triggered,
124+
;; they will try to load their dependencies (like dash or pkg-info), causing
125+
;; file errors.
126+
;; REVIEW: Report this upstream.
127+
(defadvice! doom--fix-loaddefs-generate--parse-file-a (fn &rest args)
128+
:around #'loaddefs-generate--parse-file
129+
(let (emacs-lisp-mode-hook)
130+
(apply fn args)))
131+
119132

120133
;;
121134
;;; native-comp

0 commit comments

Comments
 (0)