fix: doom/reload runs remotely in tramp buffers

When run in a remote buffer, `doom sync` is executed on the remote host,
which is not intended behavior.

Fix #5378
This commit is contained in:
Henrik Lissner 2021-08-14 02:28:14 -04:00
parent 9b177957f8
commit 462bfb9693

View file

@ -51,18 +51,19 @@ And jumps to your `doom!' block."
(defmacro doom--if-compile (command on-success &optional on-failure)
(declare (indent 2))
`(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))))
`(let ((default-directory doom-emacs-dir))
(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)))))
;;;###autoload
(defun doom/reload ()
@ -115,8 +116,10 @@ Doing so from within Emacs will taint your shell environment.
An envvar file contains a snapshot of your shell environment, which can be
imported into Emacs."
(interactive)
(doom-load-envvars-file doom-env-file)
(message "Reloaded %S" (abbreviate-file-name doom-env-file)))
(let ((default-directory doom-emacs-dir))
(with-temp-buffer
(doom-load-envvars-file doom-env-file)
(message "Reloaded %S" (abbreviate-file-name doom-env-file)))))
;;;###autoload
(defun doom/upgrade ()