From 1d8c61698bd46978ff71be533538a02c9fba8a28 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 8 Aug 2022 20:15:20 +0200 Subject: [PATCH] fix: "symbol's value as variable is void: \213" error (part 2) See 6f1c0f7cc71a for part 1. Turns out startup.elc likely exists on most Emacs installations (and, since it's so integral to Emacs, it likely gets special treatment), so it was a poor heuristic for this fix. Instead, a more variable target would be calc-loaddefs.el. On some systems, only calc-loaddefs.el.gz exists (in which case, we should turn off the optimization). On others, calc-loaddefs.el exists (so I'll assume it's safe to leave them on). I won't check for calc-loaddefs.elc because it doesn't matter; calc.el explicitly calls (load "calc-loaddefs.el") so it is never loaded. Of course, you can sidestep the entire issue by building Emacs with --without-compress-install, but it's not practical for users to know/want to do that. Amend: 6f1c0f7cc71a --- lisp/cli/autoloads.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/cli/autoloads.el b/lisp/cli/autoloads.el index 9cf65a28d..b0567554b 100644 --- a/lisp/cli/autoloads.el +++ b/lisp/cli/autoloads.el @@ -45,13 +45,18 @@ 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)) + ;; HACK 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. + ;; + ;; calc-loaddefs.el is a good heuristic for this because calc.el + ;; explicitly tries to load the un-compiled calc-loaddefs.el. If it + ;; doesn't exist, it'll go for calc-loaddefs.el.gz instead. + (unless (locate-file "calc-loaddefs.el" (get 'load-path 'initial-value) nil) `((unless noninteractive (doom-reset-file-handler-alist-h) - (remove-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h 101)))) + (remove-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h)))) (cl-loop for var in doom-autoloads-cached-vars when (boundp var) collect `(set ',var ',(symbol-value var)))