From 7e931ec58634e6499d91c71c75d31f6a0e498e77 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 10 Sep 2022 12:38:53 +0200 Subject: [PATCH] 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 --- lisp/doom-packages.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lisp/doom-packages.el b/lisp/doom-packages.el index 321c441b0..f55e2c50a 100644 --- a/lisp/doom-packages.el +++ b/lisp/doom-packages.el @@ -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