From: Evgenii Klimov Date: Thu, 29 Aug 2024 22:36:12 +0000 (+0100) Subject: Make 'python-shell--with-environment' respect buffer-local vars X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=08a5ab24ddd344de795a8473d8abefeb34396e47;p=emacs.git Make 'python-shell--with-environment' respect buffer-local vars * lisp/progmodes/python.el (python-shell--with-environment): Make `with-temp-buffer' respect buffer-local values of `process-environment' and `exec-path', if set. (Bug#72849) (cherry picked from commit 5fd75133cfe389004f9fca8f11e093e531c45fe2) --- diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 6914a663af0..00521eace04 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3030,11 +3030,11 @@ machine then modifies `tramp-remote-process-environment' and (tramp-dissect-file-name default-directory 'noexpand))))) (if vec (python-shell--tramp-with-environment vec extraenv bodyfun) - (let ((process-environment - (append extraenv process-environment)) - (exec-path - ;; FIXME: This is still Python-specific. - (python-shell-calculate-exec-path))) + (cl-letf (((default-value 'process-environment) + (append extraenv process-environment)) + ((default-value 'exec-path) + ;; FIXME: This is still Python-specific. + (python-shell-calculate-exec-path))) (funcall bodyfun))))) (defun python-shell--tramp-with-environment (vec extraenv bodyfun)