Refactor doom/reload

+ Remove non-interactive use-case (no more relying on the server; too
  unstable).
+ Ensure autoloads are properly reloaded (and thus, the load-path is
  properly repopulated).
+ Provide feedback when it's finished
This commit is contained in:
Henrik Lissner 2018-08-02 13:53:53 +02:00
parent 0b8f3e29d5
commit 6d1512c2e2
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -234,22 +234,11 @@ necessary), reinistalize doom (via `doom-initialize') and reloads your private
init.el and config.el. Then runs `doom-reload-hook'." init.el and config.el. Then runs `doom-reload-hook'."
(interactive "P") (interactive "P")
(require 'core-cli) (require 'core-cli)
(cond ((and noninteractive (not (daemonp))) (doom-reload-autoloads force-p)
(require 'server) (setq load-path doom-site-load-path)
(if (not (server-running-p)) (let (doom-init-p)
(doom-reload-autoloads force-p) (doom-initialize))
(print! "Reloading active Emacs session...") (with-demoted-errors "PRIVATE CONFIG ERROR: %s"
(print! (doom-initialize-modules 'force))
(bold "%%s") (run-hook-wrapped 'doom-reload-hook #'doom-try-run-hook)
(if (server-eval-at server-name '(doom/reload)) (message "Finished!"))
(green "Done!")
(red "There were issues!")))))
((progn
(require 'core-packages)
(doom-reload-autoloads force-p)
(doom-initialize 'force)
(with-demoted-errors "PRIVATE CONFIG ERROR: %s"
(doom-initialize-modules 'force))
(print! (green "%d packages reloaded" (length package-alist)))
(run-hook-wrapped 'doom-reload-hook #'doom-try-run-hook)
t))))