fix: freezing+side-effects on M-x
or C-h {f,v}
To understand this issue, you have to understand these two things: 1. Doom builds an init file which combines all its autoloads (for packages and modules), and Doom's bootstrapper (which loads modules, $DOOMDIR, etc). This init file is byte-compiled. 2. When Emacs byte-compiles elisp, docstrings are lazy-loaded (by embedding them in the elc as commented text to be retrieved later). This is generally done to save on memory. Now the issue: when these lazy-loaded docstrings are retrieved, Emacs may evaluate the whole file to find it, including Doom's bootstrap process, reloading all its files, the user's config files, and running all its startup hooks. Not only is this terribly expensive, reloading these files may have disastrous effects. One such effect is compounded by Marginalia, which invokes this docstring fetch process (by calling the `documentation` function in `marginalia--function-doc`) for *each* symbol in the `M-x` or `C-h {v,f}` completion lists, which means Doom re-bootstraps multiple times and rapidly, causing Emacs to totally lock up. The solution is to simply gate the expensive part of the initfile so it doesn't run more than once, at startup, and when `doom/reload` is called. The rest of the file loads instantly. Still, this is a bit flimsy. I'll think of a more elegant solution later.
This commit is contained in:
parent
5c9672a28a
commit
2c14eff7f1
2 changed files with 62 additions and 45 deletions
|
@ -358,7 +358,12 @@ If RETURN-P, return the message as a string instead of displaying it."
|
|||
;; Compiling them in one place is a big reduction in startup
|
||||
;; time, and by keeping a history of them, you get a snapshot
|
||||
;; of your config in time.
|
||||
(file-name-concat doom-profile-dir (format "init.%d.elc" emacs-major-version))))
|
||||
(file-name-concat
|
||||
doom-profile-dir (format "init.%d.elc" emacs-major-version)))
|
||||
;; If the config is being reloaded, let's pretend it hasn't be
|
||||
;; initialized by unsetting this (see note in
|
||||
;; `doom-profile--generate-load-modules' for details).
|
||||
doom-init-time)
|
||||
;; If `user-init-file' is t, then `load' will store the name of
|
||||
;; the file that it loads into `user-init-file'.
|
||||
(setq user-init-file t)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue