From ece87c73bcb5f8e2a59769cfe981c1486e19857b Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Thu, 29 Apr 2021 12:45:04 +0200 Subject: [PATCH] Make `compile' respect buffer-local process environment * lisp/progmodes/compile.el (compilation-start): Use `process-environment' from original buffer in the compilation process. --- lisp/progmodes/compile.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 7a02c3a896..ee73f03c93 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1779,6 +1779,8 @@ compilation-start (replace-regexp-in-string "-mode\\'" "" (symbol-name mode)))) (thisdir default-directory) (thisenv compilation-environment) + (this-process-environment process-environment) + (env-buffer (when (local-variable-p 'process-environment) (buffer-name))) outwin outbuf) (with-current-buffer (setq outbuf @@ -1856,6 +1858,9 @@ compilation-start "; default-directory: " (prin1-to-string (abbreviate-file-name default-directory)) " -*-\n" + (if env-buffer + (format "Process environment is local to buffer `%s'\n" env-buffer) + "") (format "%s started at %s\n\n" mode-name (substring (current-time-string) 0 19)) @@ -1875,7 +1880,7 @@ compilation-start (and (derived-mode-p 'comint-mode) (comint-term-environment)) (list (format "INSIDE_EMACS=%s,compile" emacs-version)) - (copy-sequence process-environment)))) + (copy-sequence this-process-environment)))) (setq-local compilation-arguments (list command mode name-function highlight-regexp)) (setq-local revert-buffer-function 'compilation-revert-buffer) -- 2.30.2