From 332a23285a910a413cd58aea63c9ed581dcf9100 Mon Sep 17 00:00:00 2001 From: Ethan Glasser-Camp Date: Thu, 23 Jun 2022 10:51:32 -0400 Subject: Add some comments documenting the change Thanks @brotzeit for the suggestion. --- rust-cargo.el | 7 +++++++ 1 file changed, 7 insertions(+) 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) -- cgit v1.2.3