fix(lib): doom/{reload,upgrade}: ensure env matches session

This commit is contained in:
Henrik Lissner 2024-08-24 17:25:35 -04:00
parent a8ba8feecb
commit 9c6a5e9323
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

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