summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSibi Prabakaran <sibi@psibi.in>2024-05-20 13:19:46 +0530
committerGitHub <noreply@github.com>2024-05-20 13:19:46 +0530
commitd00d83d3a207a5b7c2994392b2781f627e3159ce (patch)
tree3f2eba0370637a420660cbd3a4d9849c72882260
parent5e96cd08a27bb7c9edd0d247cc211be49eeacfdc (diff)
parentca4fafe0ddbaa1f0470524a7f0dc6d6587314254 (diff)
downloadrust-mode-d00d83d3a207a5b7c2994392b2781f627e3159ce.tar.gz
Merge pull request #546 from bradneuman/workspace-local
Adds a customization to default to workspace or local crate.
-rw-r--r--rust-cargo.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/rust-cargo.el b/rust-cargo.el
index cd2214a..d9f1be5 100644
--- a/rust-cargo.el
+++ b/rust-cargo.el
@@ -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
@@ -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)