diff --git a/core/autoload/config.el b/core/autoload/config.el index 1e643cf49..00166d58f 100644 --- a/core/autoload/config.el +++ b/core/autoload/config.el @@ -3,10 +3,6 @@ (defvar doom-bin-dir (concat doom-emacs-dir "bin/")) (defvar doom-bin (concat doom-bin-dir "doom")) -;;;###autoload -(defvar doom-reload-hook nil - "A list of hooks to run when `doom/reload' is called.") - ;;;###autoload (defvar doom-reloading-p nil "TODO") @@ -76,7 +72,7 @@ This is experimental! It will try to do as `bin/doom sync' does, but from within this Emacs session. i.e. it reload autoloads files (if necessary), reloads your package list, and lastly, reloads your private config.el. -Runs `doom-reload-hook' afterwards." +Runs `doom-after-reload-hook' afterwards." (interactive) (require 'core-cli) (when (and IS-WINDOWS (file-exists-p doom-env-file)) @@ -86,13 +82,14 @@ Runs `doom-reload-hook' afterwards." (mapc #'require (cdr doom-incremental-packages)) (doom--if-compile (format "%s sync -e" doom-bin) (let ((doom-reloading-p t)) + (run-hook-wrapped 'doom-before-reload-hook #'doom-try-run-hook) (doom-initialize 'force) (with-demoted-errors "PRIVATE CONFIG ERROR: %s" (general-auto-unbind-keys) (unwind-protect (doom-initialize-modules 'force) (general-auto-unbind-keys t))) - (run-hook-wrapped 'doom-reload-hook #'doom-try-run-hook) + (run-hook-wrapped 'doom-after-reload-hook #'doom-try-run-hook) (message "Config successfully reloaded!")) (user-error "Failed to reload your config"))) diff --git a/core/core.el b/core/core.el index 3516755c2..94ed78b37 100644 --- a/core/core.el +++ b/core/core.el @@ -473,6 +473,12 @@ If this is a daemon session, load them all immediately instead." (defvar doom-first-buffer-hook nil "Transient hooks run before the first interactively opened buffer.") +(defvar doom-after-reload-hook nil + "A list of hooks to run before `doom/reload' has reloaded Doom.") + +(defvar doom-before-reload-hook nil + "A list of hooks to run after `doom/reload' has reloaded Doom.") + ;; ;;; Bootstrap helpers diff --git a/modules/completion/ivy/config.el b/modules/completion/ivy/config.el index 785a0fee5..f9f986745 100644 --- a/modules/completion/ivy/config.el +++ b/modules/completion/ivy/config.el @@ -360,7 +360,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex." (setf (alist-get fn ivy-posframe-display-functions-alist) #'ivy-display-function-fallback)) - (add-hook 'doom-reload-hook #'posframe-delete-all)) + (add-hook 'doom-after-reload-hook #'posframe-delete-all)) (use-package! flx diff --git a/modules/ui/doom/config.el b/modules/ui/doom/config.el index 980574343..61c595819 100644 --- a/modules/ui/doom/config.el +++ b/modules/ui/doom/config.el @@ -62,7 +62,7 @@ ;; HACK The fringe cannot have a buffer-local remapping on Emacs <= 26, so ;; we jump through hoops to reset it (globally) whenever it is likely ;; that the fringe will have lost its background color. - (add-hook! '(doom-load-theme-hook doom-reload-hook) :append + (add-hook! '(doom-load-theme-hook doom-after-reload-hook) :append #'solaire-mode-reset) ;; fringe can become unstyled when deleting or focusing frames