Skip to content

Commit 332a232

Browse files
committed
Add some comments documenting the change
Thanks @brotzeit for the suggestion.
1 parent 1d4b327 commit 332a232

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

rust-cargo.el

+7
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,17 @@
3030

3131
(defun rust-buffer-project ()
3232
"Get project root if possible."
33+
;; Copy environment variables into the new buffer, since
34+
;; with-temp-buffer will re-use the variables' defaults, even if
35+
;; they have been changed in this variable using e.g. envrc-mode.
36+
;; See https://github.com/purcell/envrc/issues/12.
3337
(let ((env process-environment)
3438
(path exec-path))
3539
(with-temp-buffer
40+
;; Copy the entire environment just in case there's something we
41+
;; don't know we need.
3642
(setq-local process-environment env)
43+
;; Set PATH so we can find cargo.
3744
(setq-local exec-path path)
3845
(let ((ret (call-process rust-cargo-bin nil t nil "locate-project")))
3946
(when (/= ret 0)

0 commit comments

Comments
 (0)