diff --git a/lisp/doom.el b/lisp/doom.el index 601c5c38a..ccf3d1114 100644 --- a/lisp/doom.el +++ b/lisp/doom.el @@ -247,6 +247,12 @@ Defaults to ~/.config/doom, ~/.doom.d or the value of the DOOMDIR envvar; whichever is found first. Must end in a slash.") +(defvar doom-bin-dir (expand-file-name "bin/" doom-emacs-dir) + "Where Doom's executables are stored. + +Defaults to $EMACSDIR/bin, where $EMACSDIR is `doom-emacs-dir'. Must end in a +slash.") + ;; DEPRECATED: .local will be removed entirely in 3.0 (defvar doom-local-dir (if-let (localdir (getenv-internal "DOOMLOCALDIR")) diff --git a/lisp/lib/config.el b/lisp/lib/config.el index 8fe468919..e48c9f8c3 100644 --- a/lisp/lib/config.el +++ b/lisp/lib/config.el @@ -55,7 +55,8 @@ And jumps to your `doom!' block." (defmacro doom--if-compile (command on-success &optional on-failure) (declare (indent 2)) - `(let ((default-directory doom-emacs-dir)) + `(let ((default-directory doom-emacs-dir) + (exec-path (cons doom-bin-dir exec-path))) (with-current-buffer (compile ,command t) (let ((w (get-buffer-window (current-buffer)))) (select-window w) @@ -69,6 +70,8 @@ And jumps to your `doom!' block." ,on-failure)) nil 'local))))) +(defvar doom-reload-command "doom sync -B -e" + "Command that `doom/reload' runs.") ;;;###autoload (defun doom/reload () "Reloads your private config. @@ -83,7 +86,7 @@ package list, and lastly, reloads your private config.el. Runs `doom-after-reload-hook' afterwards." (interactive) (mapc #'require (cdr doom-incremental-packages)) - (doom--if-compile (format "%S sync -e" doom-bin) + (doom--if-compile doom-reload-command (doom-context-with '(reload modules) (doom-run-hooks 'doom-before-reload-hook) (doom-load (file-name-concat doom-user-dir doom-module-init-file) t) @@ -131,10 +134,12 @@ imported into Emacs." (doom-load-envvars-file doom-env-file) (message "Reloaded %S" (abbreviate-file-name doom-env-file)))))) +(defvar doom-upgrade-command "doom upgrade -B --force" + "Command that `doom/upgrade' runs.") ;;;###autoload (defun doom/upgrade () "Run 'doom upgrade' then prompt to restart Emacs." (interactive) - (doom--if-compile (format "%S upgrade --force" doom-bin) + (doom--if-compile doom-upgrade-command (when (y-or-n-p "You must restart Emacs for the upgrade to take effect.\n\nRestart Emacs?") (doom/restart-and-restore))))