diff --git a/lisp/lib/config.el b/lisp/lib/config.el index e48c9f8c3..0bb70caa7 100644 --- a/lisp/lib/config.el +++ b/lisp/lib/config.el @@ -57,18 +57,25 @@ And jumps to your `doom!' block." (declare (indent 2)) `(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) - (add-hook - 'compilation-finish-functions - (lambda (_buf status) - (if (equal status "finished\n") - (progn - (delete-window w) - ,on-success) - ,on-failure)) - nil 'local))))) + ;; Ensure the bin/doom operates with the same environment as this + ;; running session. + (letenv! (("EMACS" (doom-path invocation-directory invocation-name)) + ("EMACSDIR" doom-emacs-dir) + ("DOOMDIR" doom-user-dir) + ("DOOMLOCALDIR" doom-local-dir) + ("DEBUG" (and doom-debug-mode "1"))) + (with-current-buffer (compile ,command t) + (let ((w (get-buffer-window (current-buffer)))) + (select-window w) + (add-hook + 'compilation-finish-functions + (lambda (_buf status) + (if (equal status "finished\n") + (progn + (delete-window w) + ,on-success) + ,on-failure)) + nil 'local)))))) (defvar doom-reload-command "doom sync -B -e" "Command that `doom/reload' runs.")