From f425f2ff3da584cfe2676f6b9cf1d81a690a75e5 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 3 Nov 2024 12:32:38 -0500 Subject: [PATCH] fix: more void-variable errors For `straight--build-cache` and `doom-modules`. Fix: #8140 Amend: 8cafbe4408e7 --- lisp/cli/doctor.el | 4 +++- lisp/doom-start.el | 10 +--------- lisp/doom.el | 3 ++- lisp/lib/profiles.el | 35 +++++++++++++++++++++++------------ 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/lisp/cli/doctor.el b/lisp/cli/doctor.el index 96200d02d..4866f724e 100644 --- a/lisp/cli/doctor.el +++ b/lisp/cli/doctor.el @@ -237,7 +237,9 @@ in." (print! (start "Checking Doom Emacs...")) (condition-case-unless-debug ex (print-group! - (require 'doom-start) + (doom-initialize t) + (doom-startup) + (require 'straight) (print! (success "Initialized Doom Emacs %s") doom-version) (print! diff --git a/lisp/doom-start.el b/lisp/doom-start.el index e7b9ad654..3832aa22a 100644 --- a/lisp/doom-start.el +++ b/lisp/doom-start.el @@ -320,15 +320,7 @@ If RETURN-P, return the message as a string instead of displaying it." (setq load-history (delete (assoc init-file-name load-history) load-history)) - (let ((startup-or-reload? - (or (doom-context-p 'startup) - (doom-context-p 'reload)))) - (when startup-or-reload? - (doom--startup-vars)) - (doom--startup-module-autoloads) - (doom--startup-package-autoloads) - (when startup-or-reload? - (doom--startup-modules))))) + (doom-startup))) ;; TODO: Add safe-mode profile. ;; (error ;; ;; HACK: This is not really this variable's intended purpose, but it diff --git a/lisp/doom.el b/lisp/doom.el index 2de1f02c3..221bf1832 100644 --- a/lisp/doom.el +++ b/lisp/doom.el @@ -704,7 +704,8 @@ of 'doom sync' or 'doom gc'." ;; DEPRECATED: Interactive sessions won't be able to interact with Straight (or ;; Elpaca) in the future, so this is temporary. (with-eval-after-load 'straight - (require 'doom-straight)) + (require 'doom-straight) + (doom-initialize-packages)) ;; diff --git a/lisp/lib/profiles.el b/lisp/lib/profiles.el index e45410bce..e6349b2e1 100644 --- a/lisp/lib/profiles.el +++ b/lisp/lib/profiles.el @@ -289,7 +289,17 @@ caches them in `doom--profiles'. If RELOAD? is non-nil, refresh the cache." (dolist (file (doom-glob init-dir "*.el")) (print-group! :level 'info (print! (start "Reading %s...") file)) - (doom-file-read file :by 'insert))) + (doom-file-read file :by 'insert)) + (prin1 `(defun doom-startup () + (let ((startup-or-reload? + (or (doom-context-p 'startup) + (doom-context-p 'reload)))) + (when startup-or-reload? + (doom--startup-vars) + (doom--startup-module-autoloads) + (doom--startup-package-autoloads) + (doom--startup-modules)))) + (current-buffer))) (print! (start "Byte-compiling %s...") (relpath init-file)) (print-group! (let ((byte-compile-warnings (if init-file-debug '(suspicious make-local callargs)))) @@ -358,18 +368,19 @@ caches them in `doom--profiles'. If RELOAD? is non-nil, refresh the cache." if (doom-module-locate-path key file) collect (module-loader key it)))) ;; FIX: Same as above (see `doom-profile--generate-init-vars'). - `((defun doom--startup-modules () + `((set 'doom-modules ',doom-modules) + (set 'doom-disabled-packages ',doom-disabled-packages) + ;; Cache module state and flags in symbol plists for quick lookup by + ;; `modulep!' later. + ,@(cl-loop + for (category . modules) in (seq-group-by #'car config-modules-list) + collect + `(setplist ',category + (quote ,(cl-loop for (_ . module) in modules + nconc `(,module ,(doom-module->context (cons category module))))))) + + (defun doom--startup-modules () (with-doom-context 'module - (set 'doom-modules ',doom-modules) - (set 'doom-disabled-packages ',doom-disabled-packages) - ;; Cache module state and flags in symbol plists for quick lookup - ;; by `modulep!' later. - ,@(cl-loop - for (category . modules) in (seq-group-by #'car config-modules-list) - collect - `(setplist ',category - (quote ,(cl-loop for (_ . module) in modules - nconc `(,module ,(doom-module->context (cons category module))))))) (let ((old-custom-file custom-file)) (with-doom-context 'init ,@(module-list-loader pre-init-modules init-file)