emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/rust-mode 26dd5ac15c 1/3: Adds a customization to default


From: ELPA Syncer
Subject: [nongnu] elpa/rust-mode 26dd5ac15c 1/3: Adds a customization to default to workspace or local crate.
Date: Mon, 20 May 2024 04:00:31 -0400 (EDT)

branch: elpa/rust-mode
commit 26dd5ac15c85ee24fe2e0dcd219466b88f2f5d7b
Author: Brad Neuman <brad.neuman@bedrockrobotics.com>
Commit: Brad Neuman <brad.neuman@bedrockrobotics.com>

    Adds a customization to default to workspace or local crate.
    
    Adds rust-locate-project-in-workspace custom variable, which controls 
whether or not to locate the workspace
    project using `--workspace` (the default) or not.
    
    In cases where there is only one create, this should make no difference.
    
    The default setting should match the existing behavior.
    
    Github issue #545
---
 rust-cargo.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/rust-cargo.el b/rust-cargo.el
index bda23d8e0a..613b861078 100644
--- a/rust-cargo.el
+++ b/rust-cargo.el
@@ -19,6 +19,13 @@
   :type 'boolean
   :group 'rust-mode)
 
+(defcustom rust-locate-project-in-workspace t
+  "Whether to use `--workspace` with `cargo locate-project`. If t,
+ rust-mode will run commands for the entire workspace. If nil,
+ rust will search for the Cargo.toml in the local crated"
+  :type 'boolean
+  :group 'rust-mode)
+
 (defcustom rust-cargo-default-arguments ""
   "Default arguments when running common cargo commands."
   :type 'string
@@ -42,7 +49,11 @@
       (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 (list rust-cargo-bin nil (list (current-buffer) nil) 
nil "locate-project")))
+               (when rust-locate-project-in-workspace
+                 (setq args (append args (list "--workspace"))))
+                 (apply #'process-file args))))
         (when (/= ret 0)
           (error "`cargo locate-project' returned %s status: %s" ret 
(buffer-string)))
         (goto-char 0)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]