Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 14 additions & 11 deletions rustic.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading