From 1d4b327b39b395dc95921f4aec975b3cebcbf563 Mon Sep 17 00:00:00 2001 From: Ethan Glasser-Camp Date: Wed, 22 Jun 2022 22:55:38 -0400 Subject: Pass process-environment and exec-path through with-temp-buffer This is the only place in rust-mode where we actually shell out, so I didn't extract this as a macro, but merely made the change in the one place it was necessary. --- rust-cargo.el | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'rust-cargo.el') diff --git a/rust-cargo.el b/rust-cargo.el index 58f0151..69ed558 100644 --- a/rust-cargo.el +++ b/rust-cargo.el @@ -30,13 +30,17 @@ (defun rust-buffer-project () "Get project root if possible." - (with-temp-buffer - (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) - (let ((output (json-read))) - (cdr (assoc-string "root" output)))))) + (let ((env process-environment) + (path exec-path)) + (with-temp-buffer + (setq-local process-environment env) + (setq-local exec-path path) + (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) + (let ((output (json-read))) + (cdr (assoc-string "root" output))))))) (defun rust-update-buffer-project () (setq-local rust-buffer-project (rust-buffer-project))) -- cgit v1.2.3