 ;; Custom hooks
 ;;
 
+(defvar doom-load-theme-hook nil
+  "Hook run when the theme (and font) is initialized (or reloaded
+with `doom//reload-theme').")
+(define-obsolete-variable-alias 'doom-init-theme-hook 'doom-load-theme-hook "2.1.0")
+
+(defvar doom-before-switch-window-hook nil
+  "Hook run before `switch-window' or `switch-frame' are called. See
+`doom-after-switch-window-hook'.")
+
+(defvar doom-after-switch-window-hook nil
+  "Hook run after `switch-window' or `switch-frame' are called. See
+`doom-before-switch-window-hook'.")
+
+(defvar doom-before-switch-buffer-hook nil
+  "Hook run before `switch-to-buffer' and `display-buffer' are called. See
+`doom-after-switch-buffer-hook'.")
+
+(defvar doom-after-switch-buffer-hook nil
+  "Hook run before `switch-to-buffer' and `display-buffer' are called. See
+`doom-before-switch-buffer-hook'.")
+
 (defun doom*switch-window-hooks (orig-fn &rest args)
   (run-hook-with-args 'doom-before-switch-window-hook)
   (prog1 (apply orig-fn args)

;; Hook(s)
(defvar doom-init-ui-hook nil
  "List of hooks to run when core-ui is initialized.")

(defvar doom-init-theme-hook nil
  "List of hooks to run when the theme (and font) is initialized (or reloaded
with `doom//reload-theme').")

(setq-default
 bidi-display-reordering nil ; disable bidirectional text for tiny performance boost

(advice-add #'select-window    :around #'doom*switch-window-hooks)
(advice-add #'switch-to-buffer :around #'doom*switch-buffer-hooks)
(advice-add #'display-buffer   :around #'doom*switch-buffer-hooks)

(defun doom*load-theme-hooks (&rest _)
  (run-hook-with-args 'doom-load-theme-hook))
(advice-add #'load-theme       :after  #'doom*load-theme-hooks)


;;
