diff options
author | Augusto Stoffel <arstoffel@gmail.com> | 2021-09-16 16:06:29 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-09-16 16:06:29 +0200 |
commit | 2172d6a28dcbc01e7e0773c9ce46d6ad4b47262a (patch) | |
tree | 23b15e2cbdbc16672caf0ed75ee3c9bf59770f50 /lisp/progmodes/compile.el | |
parent | 7b3007336fedc30a1bce096fcc910a0a36370ee0 (diff) | |
download | emacs-2172d6a28dcbc01e7e0773c9ce46d6ad4b47262a.tar.gz emacs-2172d6a28dcbc01e7e0773c9ce46d6ad4b47262a.tar.bz2 emacs-2172d6a28dcbc01e7e0773c9ce46d6ad4b47262a.zip |
Make 'compile' respect buffer-local process environment
* lisp/progmodes/compile.el (compilation-start): Use
`process-environment' from original buffer in the compilation
process (bug#50607).
Diffstat (limited to 'lisp/progmodes/compile.el')
-rw-r--r-- | lisp/progmodes/compile.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 8d1486b6e68..431b01b8ba9 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1783,6 +1783,9 @@ Returns the compilation buffer created." (replace-regexp-in-string "-mode\\'" "" (symbol-name mode)))) (thisdir default-directory) (thisenv compilation-environment) + (buffer-path (and (local-variable-p 'exec-path) exec-path)) + (buffer-env (and (local-variable-p 'process-environment) + process-environment)) outwin outbuf) (with-current-buffer (setq outbuf @@ -1850,6 +1853,12 @@ Returns the compilation buffer created." ;; NB: must be done after (funcall mode) as that resets local variables (setq-local compilation-directory thisdir) (setq-local compilation-environment thisenv) + (if buffer-path + (setq-local exec-path buffer-path) + (kill-local-variable 'exec-path)) + (if buffer-env + (setq-local process-environment buffer-env) + (kill-local-variable 'process-environment)) (if highlight-regexp (setq-local compilation-highlight-regexp highlight-regexp)) (if (or compilation-auto-jump-to-first-error |