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,7 +51,8 @@ And jumps to your `doom!' block."
(defmacro doom--if-compile (command on-success &optional on-failure) (defmacro doom--if-compile (command on-success &optional on-failure)
(declare (indent 2)) (declare (indent 2))
`(with-current-buffer (compile ,command t) `(let ((default-directory doom-emacs-dir))
(with-current-buffer (compile ,command t)
(let ((w (get-buffer-window (current-buffer)))) (let ((w (get-buffer-window (current-buffer))))
(select-window w) (select-window w)
(add-hook (add-hook
@ -62,7 +63,7 @@ And jumps to your `doom!' block."
(delete-window w) (delete-window w)
,on-success) ,on-success)
,on-failure)) ,on-failure))
nil 'local)))) nil 'local)))))
;;;###autoload ;;;###autoload
(defun doom/reload () (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 An envvar file contains a snapshot of your shell environment, which can be
imported into Emacs." imported into Emacs."
(interactive) (interactive)
(let ((default-directory doom-emacs-dir))
(with-temp-buffer
(doom-load-envvars-file doom-env-file) (doom-load-envvars-file doom-env-file)
(message "Reloaded %S" (abbreviate-file-name doom-env-file))) (message "Reloaded %S" (abbreviate-file-name doom-env-file)))))
;;;###autoload ;;;###autoload
(defun doom/upgrade () (defun doom/upgrade ()