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

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

[nongnu] elpa/rust-mode 832980d96a: allow setting additional args with r


From: ELPA Syncer
Subject: [nongnu] elpa/rust-mode 832980d96a: allow setting additional args with rust-cargo-default-arguments
Date: Thu, 3 Feb 2022 13:59:09 -0500 (EST)

branch: elpa/rust-mode
commit 832980d96a3b7e985bc8bfb1dc2bd7e9599c6312
Author: brotzeit <brotzeitmacher@gmail.com>
Commit: brotzeit <brotzeitmacher@gmail.com>

    allow setting additional args with rust-cargo-default-arguments
---
 README.md     |  3 +++
 rust-cargo.el | 13 +++++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 1e841dac89..40f7037404 100644
--- a/README.md
+++ b/README.md
@@ -233,6 +233,9 @@ 
post](https://www.badykov.com/emacs/2021/05/29/emacs-cargo-mode/).
 extending it with other features such as integration with LSP and with
 flycheck.
 
+## Customization
+
+`rust-cargo-default-arguments` set additional cargo args used for 
check,compile,run,test
 
 ## For package maintainers
 
diff --git a/rust-cargo.el b/rust-cargo.el
index 30ba6114b7..58f0151f19 100644
--- a/rust-cargo.el
+++ b/rust-cargo.el
@@ -19,6 +19,11 @@
   :type 'boolean
   :group 'rust-mode)
 
+(defcustom rust-cargo-default-arguments ""
+  "Default arguments when running common cargo commands."
+  :type 'string
+  :group 'rust-mode)
+
 ;;; Buffer Project
 
 (defvar-local rust-buffer-project nil)
@@ -59,12 +64,12 @@
 (defun rust-check ()
   "Compile using `cargo check`"
   (interactive)
-  (rust--compile "%s check" rust-cargo-bin))
+  (rust--compile "%s check %s" rust-cargo-bin rust-cargo-default-arguments))
 
 (defun rust-compile ()
   "Compile using `cargo build`"
   (interactive)
-  (rust--compile "%s build" rust-cargo-bin))
+  (rust--compile "%s build %s" rust-cargo-bin rust-cargo-default-arguments))
 
 (defun rust-compile-release ()
   "Compile using `cargo build --release`"
@@ -74,7 +79,7 @@
 (defun rust-run ()
   "Run using `cargo run`"
   (interactive)
-  (rust--compile "%s run" rust-cargo-bin))
+  (rust--compile "%s run %s" rust-cargo-bin rust-cargo-default-arguments))
 
 (defun rust-run-release ()
   "Run using `cargo run --release`"
@@ -84,7 +89,7 @@
 (defun rust-test ()
   "Test using `cargo test`"
   (interactive)
-  (rust--compile "%s test" rust-cargo-bin))
+  (rust--compile "%s test %s" rust-cargo-bin rust-cargo-default-arguments))
 
 (defun rust-run-clippy ()
   "Run `cargo clippy'."



reply via email to

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