emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ee3ef57c24f: * lisp/loadup.el: Add workaround for occasional "boo


From: Stefan Monnier
Subject: master ee3ef57c24f: * lisp/loadup.el: Add workaround for occasional "bootstrap" failure
Date: Thu, 16 May 2024 09:50:45 -0400 (EDT)

branch: master
commit ee3ef57c24fe3435cd896e1f096aadff5f9372a0
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * lisp/loadup.el: Add workaround for occasional "bootstrap" failure
---
 lisp/loadup.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lisp/loadup.el b/lisp/loadup.el
index c6a8dcbb909..aab1231c8be 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -191,6 +191,23 @@
   (setq definition-prefixes new))
 
 (load "button")                  ;After loaddefs, because of define-minor-mode!
+
+(when (interpreted-function-p (symbol-function 'add-hook))
+  ;; `subr.el' is needed early and hence can't use macros like `setf'
+  ;; liberally.  Yet, it does use such macros in code that it knows will not
+  ;; be executed too early, such as `add-hook'.  Usually, by the time we
+  ;; run that code, either `subr.el' was already compiled to start with
+  ;; or on the contrary many files aren't compiled yet and have thus caused
+  ;; macro packages like `gv' to be loaded.  But not always.
+  ;; The specific error we're trying to work around, here, occurs when
+  ;; `cl-preloaded's `provide' ends up (because of an `eval-after-load')
+  ;; calling `add-hook' which burps with a "void-function setf" on
+  ;; (setf (get hook 'hook--depth-alist) depth-sym)'.
+  ;; FIXME: We should probably split `subr.el' into one that's loaded early
+  ;; where we refrain from using macros like `setf', and another loaded later
+  ;; where we can blissfully `require' packages like `gv'.
+  (require 'gv))
+
 (load "emacs-lisp/cl-preloaded")
 (load "emacs-lisp/oclosure")          ;Used by cl-generic
 (load "obarray")        ;abbrev.el is implemented in terms of obarrays.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]