Skip to content

Commit c1e1d5d

Browse files
authored
Merge pull request #76 from tylerjl/cargo-workspace-remote-p
Fix issue resolving cargo binary without default-directory
2 parents 1a38bb4 + a6261c8 commit c1e1d5d

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

CHANGELOG.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Replace Cask with Eask for CI testing.
77
- Implement ~rustic-cargo-nextest-current-test~ for running test at a
88
point using nextest.
9+
- Fixed an issue where workspaces were not resolved correctly over TRAMP.
910

1011
* 3.5
1112

rustic.el

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,20 @@ as for that macro."
8989
;; this variable is buffer local so we can use the cached value
9090
(if rustic--buffer-workspace
9191
rustic--buffer-workspace
92-
(rustic--with-temp-process-buffer
93-
(let ((ret (process-file (rustic-cargo-bin) nil (list (current-buffer) nil) nil "locate-project" "--workspace")))
94-
(cond ((and (/= ret 0) nodefault)
95-
(error "`cargo locate-project' returned %s status: %s" ret (buffer-string)))
96-
((and (/= ret 0) (not nodefault))
97-
(setq rustic--buffer-workspace default-directory))
98-
(t
99-
(goto-char 0)
100-
(let* ((output (json-read))
101-
(dir (file-name-directory (cdr (assoc-string "root" output)))))
102-
(setq rustic--buffer-workspace dir))))))))
92+
;; Resolve the bin path while still buffer local (in cases like
93+
;; remote via TRAMP)
94+
(let ((cargo-bin (rustic-cargo-bin)))
95+
(rustic--with-temp-process-buffer
96+
(let ((ret (process-file cargo-bin nil (list (current-buffer) nil) nil "locate-project" "--workspace")))
97+
(cond ((and (/= ret 0) nodefault)
98+
(error "`cargo locate-project' returned %s status: %s" ret (buffer-string)))
99+
((and (/= ret 0) (not nodefault))
100+
(setq rustic--buffer-workspace default-directory))
101+
(t
102+
(goto-char 0)
103+
(let* ((output (json-read))
104+
(dir (file-name-directory (cdr (assoc-string "root" output)))))
105+
(setq rustic--buffer-workspace dir)))))))))
103106

104107
(defun rustic-buffer-crate (&optional nodefault)
105108
"Return the crate for the current buffer.

0 commit comments

Comments
 (0)