refactor(dashboard): reduce work on init

And set `doom-fallback-buffer-name` and `initial-buffer-choice`
sooner (makes it easier for users to override).
This commit is contained in:
Henrik Lissner 2026-03-25 19:42:04 -04:00
parent 8f97fe4aff
commit 77f2b5abbb
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -224,13 +224,10 @@ dashboard reloading is inhibited.")
(unless noninteractive
;; Ensure the dashboard becomes Emacs' go-to buffer when there's nothing
;; else to show.
(setq doom-fallback-buffer-name +dashboard-name
initial-buffer-choice #'doom-fallback-buffer)
(unless fancy-splash-image
(setq fancy-splash-image
(expand-file-name +dashboard-banner-file
+dashboard-banner-dir)))
(+dashboard-reload)
(add-hook 'doom-load-theme-hook #'+dashboard-reload-on-theme-change-h)
;; Ensure the dashboard is up-to-date whenever it is switched to or resized.
(add-hook 'window-size-change-functions #'+dashboard-resize-h)
@ -245,6 +242,8 @@ dashboard reloading is inhibited.")
(add-hook 'persp-activated-functions #'+dashboard-reload-maybe-h))
(add-hook 'persp-before-switch-functions #'+dashboard--persp-record-project-h)))
(setq doom-fallback-buffer-name +dashboard-name
initial-buffer-choice #'doom-fallback-buffer)
(add-hook 'doom-init-ui-hook #'+dashboard-init-h 'append)
;; PERF: Make sure the dashboard is ready early, so as to avoid triggering