fix: "symbol's value as variable is void: \213" error

Some installs of Emacs do not come with byte-compiled versions of its
bundled elisp files, so when loading them, Emacs falls back to loading
its *.el.gz files. This would be fine if it were not for a  startup
optimization Doom employs, where it sets file-name-handler-alist to
nil (and by doing so, robs Emacs of the ability to read compressed
elisp). This causes "symbol's value as variable is void: \213" errors at
startup.

With this commit, Doom now disables this optimization early if it
suspects this applies to your install. But time will tell if it's early
enough.

Ref: https://mail.gnu.org/archive/html/emacs-devel/2022-08/msg00234.html
This commit is contained in:
Henrik Lissner 2022-08-08 18:52:32 +02:00
parent f0e508b52d
commit 6f1c0f7cc7
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -45,6 +45,13 @@ one wants that.")
(signal 'doom-error
(list "The installed version of Doom has changed since last 'doom sync' ran"
"Run 'doom sync' to bring Doom up to speed"))))
;; If the bundled elisp for this Emacs install isn't byte-compiled,
;; disengage the `file-name-handler-alist' optimization early to
;; prevent encoding errors when Emacs tries to read gzipped elisp.
(unless (locate-file "startup.elc" (get 'load-path 'initial-value))
`((unless noninteractive
(doom-reset-file-handler-alist-h)
(remove-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h 101))))
(cl-loop for var in doom-autoloads-cached-vars
when (boundp var)
collect `(set ',var ',(symbol-value var)))