summaryrefslogtreecommitdiff
path: root/rust-mode.el
diff options
context:
space:
mode:
authorAankhen <Aankhen@users.noreply.github.com>2017-06-26 18:37:52 +0530
committerAankhen <Aankhen@users.noreply.github.com>2017-07-13 11:46:06 +0530
commitb4077f8be2163b71b33a12932ef1013874646a9c (patch)
tree0928a8c726f3c2c90f41802283c7ee1a98034214 /rust-mode.el
parent9afe9972ca97eaa1fdeae86a691b2c448552843c (diff)
downloadrust-mode-b4077f8be2163b71b33a12932ef1013874646a9c.tar.gz
Add `rust-cargo-bin' custom variable.
Diffstat (limited to 'rust-mode.el')
-rw-r--r--rust-mode.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/rust-mode.el b/rust-mode.el
index a1d98b0..2c58545 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -149,6 +149,11 @@ function or trait. When nil, where will be aligned with fn or trait."
:type 'string
:group 'rust-mode)
+(defcustom rust-cargo-bin "cargo"
+ "Path to cargo executable."
+ :type 'string
+ :group 'rust-mode)
+
(defcustom rust-always-locate-project-on-open nil
"Whether to run `cargo locate-project' every time `rust-mode'
is activated."
@@ -1569,7 +1574,7 @@ visit the new file."
(interactive)
(when (null rust-buffer-project)
(rust-update-buffer-project))
- (let* ((args (list "cargo" "clippy" (concat "--manifest-path=" rust-buffer-project)))
+ (let* ((args (list rust-cargo-bin "clippy" (concat "--manifest-path=" rust-buffer-project)))
;; set `compile-command' temporarily so `compile' doesn't
;; clobber the existing value
(compile-command (mapconcat #'shell-quote-argument args " ")))
@@ -1581,7 +1586,7 @@ visit the new file."
(defun rust-buffer-project ()
"Get project root if possible."
(with-temp-buffer
- (let ((ret (call-process "cargo" nil t nil "locate-project")))
+ (let ((ret (call-process rust-cargo-bin nil t nil "locate-project")))
(when (/= ret 0)
(error "`cargo locate-project' returned %s status: %s" ret (buffer-string)))
(goto-char 0)