refactor: record doom-init-time in doom-after-init-hook

This commit is contained in:
Henrik Lissner 2022-09-23 22:03:38 +02:00
parent dda848e089
commit a3a275624e
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
2 changed files with 10 additions and 11 deletions

View file

@ -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))