Skip to content

Commit

Permalink
Make 'compile' respect buffer-local process environment
Browse files Browse the repository at this point in the history
* lisp/progmodes/compile.el (compilation-start): Use
`process-environment' from original buffer in the compilation
process (bug#50607).
  • Loading branch information
astoff authored and larsmagne committed Sep 16, 2021
1 parent 7b30073 commit 2172d6a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lisp/progmodes/compile.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2172d6a

Please sign in to comment.