mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
fix: trigger doom-first-{file,buffer}-hook at startup
Should fix issues where modes/hooks weren't triggered for files/directories opened early (e.g. from the command-line or programmatically from the user's config).
This commit is contained in:
@ -322,6 +322,15 @@ If RETURN-P, return the message as a string instead of displaying it."
|
||||
(doom-run-hook-on 'doom-first-buffer-hook '(find-file-hook doom-switch-buffer-hook))
|
||||
(doom-run-hook-on 'doom-first-file-hook '(find-file-hook dired-initial-position-hook))
|
||||
(doom-run-hook-on 'doom-first-input-hook '(pre-command-hook))
|
||||
|
||||
;; If the user's already opened something (e.g. with command-line arguments),
|
||||
;; then we should assume nothing about the user's intentions and simply treat
|
||||
;; this session as fully initialized.
|
||||
(add-hook! 'doom-after-init-hook :depth 100
|
||||
(defun doom-run-first-hooks-if-files-open-h ()
|
||||
(when file-name-history
|
||||
(doom-run-hooks 'doom-first-file-hook 'doom-first-buffer-hook))))
|
||||
|
||||
;; PERF: Activate these later, otherwise they'll fire for every buffer created
|
||||
;; between now and the end of startup.
|
||||
(add-hook! 'after-init-hook
|
||||
|
Reference in New Issue
Block a user