diff --git a/lisp/doom-start.el b/lisp/doom-start.el index 60685b409..8949b00f0 100644 --- a/lisp/doom-start.el +++ b/lisp/doom-start.el @@ -262,9 +262,6 @@ If this is a daemon session, load them all immediately instead." ;; ;;; Benchmark -(defvar doom-init-time nil - "The time it took, in seconds, for Doom Emacs to initialize.") - (defun doom-display-benchmark-h (&optional return-p) "Display a benchmark including number of packages and modules loaded. @@ -273,9 +270,7 @@ If RETURN-P, return the message as a string instead of displaying it." "Doom loaded %d packages across %d modules in %.03fs" (- (length load-path) (length (get 'load-path 'initial-value))) (hash-table-count doom-modules) - (or doom-init-time - (setq doom-init-time - (float-time (time-subtract (current-time) before-init-time)))))) + doom-init-time)) ;; @@ -370,11 +365,7 @@ If RETURN-P, return the message as a string instead of displaying it." ;; 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))) - ;; 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) + doom-profile-dir (format "init.%d.elc" emacs-major-version)))) ;; If `user-init-file' is t, then `load' will store the name of ;; the next file it loads into `user-init-file'. (setq user-init-file t) diff --git a/lisp/doom.el b/lisp/doom.el index 19b44da8c..b4c65bf24 100644 --- a/lisp/doom.el +++ b/lisp/doom.el @@ -163,6 +163,9 @@ (defconst doom-modules-version "22.09.0-pre" "Current version of Doom Emacs.") +(defvar doom-init-time nil + "The time it took, in seconds, for Doom Emacs to initialize.") + (defconst doom-profile (if-let (profile (getenv-internal "DOOMPROFILE")) (save-match-data @@ -592,6 +595,11 @@ triggered. This is the absolute latest point in the startup process." (dolist (var '(exec-path load-path process-environment)) (put var 'initial-value (default-toplevel-value var))))) +(add-hook! 'doom-after-init-hook :depth -110 + (defun doom--end-init-h () + "Set `doom-init-time'." + (setq doom-init-time (float-time (time-subtract (current-time) before-init-time))))) + ;; This is the absolute latest a hook can run in Emacs' startup process. (define-advice command-line-1 (:after (&rest _) run-after-init-hook) (doom-run-hooks 'doom-after-init-hook))