From 832980d96a3b7e985bc8bfb1dc2bd7e9599c6312 Mon Sep 17 00:00:00 2001 From: brotzeit Date: Thu, 3 Feb 2022 19:31:52 +0100 Subject: allow setting additional args with rust-cargo-default-arguments --- rust-cargo.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'rust-cargo.el') diff --git a/rust-cargo.el b/rust-cargo.el index 30ba611..58f0151 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'." -- cgit v1.2.3