diff --git a/CHANGELOG.org b/CHANGELOG.org index 84db999..8a55347 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -6,6 +6,7 @@ - Replace Cask with Eask for CI testing. - Implement ~rustic-cargo-nextest-current-test~ for running test at a point using nextest. +- Fixed an issue where workspaces were not resolved correctly over TRAMP. * 3.5 diff --git a/rustic.el b/rustic.el index 6360626..2d66580 100644 --- a/rustic.el +++ b/rustic.el @@ -89,17 +89,20 @@ as for that macro." ;; this variable is buffer local so we can use the cached value (if rustic--buffer-workspace rustic--buffer-workspace - (rustic--with-temp-process-buffer - (let ((ret (process-file (rustic-cargo-bin) nil (list (current-buffer) nil) nil "locate-project" "--workspace"))) - (cond ((and (/= ret 0) nodefault) - (error "`cargo locate-project' returned %s status: %s" ret (buffer-string))) - ((and (/= ret 0) (not nodefault)) - (setq rustic--buffer-workspace default-directory)) - (t - (goto-char 0) - (let* ((output (json-read)) - (dir (file-name-directory (cdr (assoc-string "root" output))))) - (setq rustic--buffer-workspace dir)))))))) + ;; Resolve the bin path while still buffer local (in cases like + ;; remote via TRAMP) + (let ((cargo-bin (rustic-cargo-bin))) + (rustic--with-temp-process-buffer + (let ((ret (process-file cargo-bin nil (list (current-buffer) nil) nil "locate-project" "--workspace"))) + (cond ((and (/= ret 0) nodefault) + (error "`cargo locate-project' returned %s status: %s" ret (buffer-string))) + ((and (/= ret 0) (not nodefault)) + (setq rustic--buffer-workspace default-directory)) + (t + (goto-char 0) + (let* ((output (json-read)) + (dir (file-name-directory (cdr (assoc-string "root" output))))) + (setq rustic--buffer-workspace dir))))))))) (defun rustic-buffer-crate (&optional nodefault) "Return the crate for the current buffer.