         (print! (green "✓ Clean up autoloads")))
       ;; Byte compile it to give the file a chance to reveal errors.
       (doom--byte-compile-file doom-autoload-file)
-      (doom--server-load doom-autoload-file)
+      (doom--do-load doom-autoload-file)
       t)))
 
 

        (doom--cleanup-package-autoloads)
        (print! (green "✓ Removed load-path/auto-mode-alist entries"))))
    (doom--byte-compile-file doom-package-autoload-file)
    (doom--server-load doom-package-autoload-file)
    t))



  (when (funcall fn doom-auto-accept)
    (doom-reload-package-autoloads)))

(defun doom--warn-refresh-session ()
  (message "Detected a running Emacs session.\n")
  (message "Use `M-x doom/reload' for changes to take effect."))

(defun doom--do-load (&rest files)
  (if (and noninteractive (not (daemonp)))
      (progn
        (require 'server)
        (when (server-running-p)
          (add-hook 'kill-emacs-hook #'doom--warn-refresh-session)))
    (dolist (file files)
      (load-file (byte-compile-dest-file file)))))

