From 309cc3683368a316de6f43f5792a5cd7b19d8143 Mon Sep 17 00:00:00 2001 From: Jiangbin Zhao Date: Sat, 6 Jan 2018 14:25:10 -0800 Subject: [PATCH 1/3] Add customization setting for path to rustc executable --- cargo-process.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cargo-process.el b/cargo-process.el index 46f1b63..536f30f 100644 --- a/cargo-process.el +++ b/cargo-process.el @@ -60,6 +60,14 @@ :type 'file :group 'cargo-process) +(defcustom cargo-process--rustc-cmd + (or (executable-find "rustc") + (expand-file-name "rustc" "~/.cargo/bin") + "/usr/local/bin/rustc") + "Custom path to the rustc executable" + :type 'file + :group 'cargo-process) + (defcustom cargo-process--enable-rust-backtrace nil "Set RUST_BACKTRACE environment variable to 1 for tasks test and run" :group 'cargo-process) @@ -245,7 +253,7 @@ Always set to nil if cargo-process--enable-rust-backtrace is nil" (save-excursion (with-help-window (help-buffer) (princ (shell-command-to-string - (concat "rustc --explain=" errno))) + (concat cargo-process--rustc-cmd " --explain=" errno))) (with-current-buffer standard-output (buffer-string))))) From 2b0ebc974a9ba4c66753944ef2a87963226823ff Mon Sep 17 00:00:00 2001 From: Jiangbin Zhao Date: Sat, 6 Jan 2018 14:26:52 -0800 Subject: [PATCH 2/3] Better default value for cargo-process--custom-path-to-bin --- cargo-process.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cargo-process.el b/cargo-process.el index 536f30f..5229bcf 100644 --- a/cargo-process.el +++ b/cargo-process.el @@ -55,7 +55,10 @@ :prefix "cargo-process-" :group 'cargo) -(defcustom cargo-process--custom-path-to-bin "cargo" +(defcustom cargo-process--custom-path-to-bin + (or (executable-find "cargo") + (expand-file-name "cargo" "~/.cargo/bin") + "/usr/local/bin/cargo") "Custom path to the cargo executable" :type 'file :group 'cargo-process) From 806ddd8b821fb6936258d8647a3fd1858377b4ab Mon Sep 17 00:00:00 2001 From: Jiangbin Zhao Date: Sat, 6 Jan 2018 14:27:35 -0800 Subject: [PATCH 3/3] Fix a compilation warning: argument shadowing variable name --- cargo-process.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cargo-process.el b/cargo-process.el index 5229bcf..92332ac 100644 --- a/cargo-process.el +++ b/cargo-process.el @@ -223,12 +223,12 @@ Always set to nil if cargo-process--enable-rust-backtrace is nil" (setenv cargo-process--rust-backtrace "1") (setenv cargo-process--rust-backtrace nil)))) -(defun cargo-process--start (name command &optional last-command) +(defun cargo-process--start (name command &optional last-cmd) "Start the Cargo process NAME with the cargo command COMMAND." (set-rust-backtrace command) (let* ((buffer (concat "*Cargo " name "*")) (cmd - (or last-command + (or last-cmd (cargo-process--maybe-read-command (mapconcat #'identity (list cargo-process--custom-path-to-bin command