summaryrefslogtreecommitdiff
path: root/rust-cargo.el
diff options
context:
space:
mode:
authorEthan Glasser-Camp <ethan@betacantrips.com>2022-06-23 10:51:32 -0400
committerEthan Glasser-Camp <ethan@betacantrips.com>2022-06-23 10:51:32 -0400
commit332a23285a910a413cd58aea63c9ed581dcf9100 (patch)
treeb51f38975619d40fe7c9bf9fc97f09743ecc0b2d /rust-cargo.el
parent1d4b327b39b395dc95921f4aec975b3cebcbf563 (diff)
downloadrust-mode-332a23285a910a413cd58aea63c9ed581dcf9100.tar.gz
Add some comments documenting the change
Thanks @brotzeit for the suggestion.
Diffstat (limited to 'rust-cargo.el')
-rw-r--r--rust-cargo.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/rust-cargo.el b/rust-cargo.el
index 69ed558..9f6e611 100644
--- a/rust-cargo.el
+++ b/rust-cargo.el
@@ -30,10 +30,17 @@
(defun rust-buffer-project ()
"Get project root if possible."
+ ;; Copy environment variables into the new buffer, since
+ ;; with-temp-buffer will re-use the variables' defaults, even if
+ ;; they have been changed in this variable using e.g. envrc-mode.
+ ;; See https://github.com/purcell/envrc/issues/12.
(let ((env process-environment)
(path exec-path))
(with-temp-buffer
+ ;; Copy the entire environment just in case there's something we
+ ;; don't know we need.
(setq-local process-environment env)
+ ;; Set PATH so we can find cargo.
(setq-local exec-path path)
(let ((ret (call-process rust-cargo-bin nil t nil "locate-project")))
(when (/= ret 0)