 ;;
 ;;; Bootstrap
 
-(defun doom-init-ui-h ()
+(defun doom-init-ui-h (&optional _)
   "Initialize Doom's user interface by applying all its advice and hooks."
-  ;; Produce more helpful (and visible) error messages from errors emitted from
-  ;; hooks (particularly mode hooks, that usually go unnoticed otherwise.
-  (advice-add #'run-hooks :override #'doom-run-hooks)
-
   (doom-run-hooks 'doom-init-ui-hook)
 
   (add-hook 'kill-buffer-query-functions #'doom-protect-fallback-buffer-h)

  ;; These should be done as late as possible, as not to prematurely trigger
  ;; hooks during startup.
  (add-hook 'window-buffer-change-functions #'doom-run-switch-buffer-hooks-h)
  (add-hook 'window-selection-change-functions #'doom-run-switch-window-or-frame-hooks-h))

;; Apply `doom-font' et co
(let ((hook (if (daemonp) 'server-after-make-frame-hook)))
  (add-hook (or hook 'after-init-hook)
            #'doom-init-fonts-h
            -100)
  (add-hook (or hook 'after-init-hook)
            #'doom-init-theme-h
            -90)
  (add-hook (or hook 'window-setup-hook)
            #'doom-init-ui-h
            100))


;;

  ;; Give users a chance to inject their own font logic.
  (run-hooks 'after-setting-font-hook))

(defun doom-init-theme-h (&rest _)
  "Load the theme specified by `doom-theme' in FRAME."
  (when (and doom-theme (not (custom-theme-enabled-p doom-theme)))
    (load-theme doom-theme t)))
