Skip to content

Commit

Permalink
Merge pull request #546 from bradneuman/workspace-local
Browse files Browse the repository at this point in the history
Adds a customization to default to workspace or local crate.
  • Loading branch information
psibi authored May 20, 2024
2 parents 5e96cd0 + ca4fafe commit d00d83d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion rust-cargo.el
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
:type 'boolean
:group 'rust-mode)

(defcustom rust-cargo-locate-default-arguments '("--workspace")
"Arguments for `cargo locate-project`. Remove `--workspace` if you
would prefer to use the local crate Cargo.toml instead of the
worksapce for commands like `cargo check`."
:type '(repeat string)
:group 'rust-mode)

(defcustom rust-cargo-default-arguments ""
"Default arguments when running common cargo commands."
:type 'string
Expand All @@ -42,7 +49,13 @@
(setq-local process-environment env)
;; Set PATH so we can find cargo.
(setq-local exec-path path)
(let ((ret (process-file rust-cargo-bin nil (list (current-buffer) nil) nil "locate-project" "--workspace")))
(let ((ret
(let ((args
(append
(list rust-cargo-bin nil (list (current-buffer) nil) nil
"locate-project")
rust-cargo-locate-default-arguments)))
(apply #'process-file args))))
(when (/= ret 0)
(error "`cargo locate-project' returned %s status: %s" ret (buffer-string)))
(goto-char 0)
Expand Down

0 comments on commit d00d83d

Please sign in to comment.