Function: python-shell--tramp-with-environment

python-shell--tramp-with-environment is a byte-compiled function defined in python.el.gz.

Signature

(python-shell--tramp-with-environment VEC EXTRAENV BODYFUN)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python-shell--tramp-with-environment (vec extraenv bodyfun)
  (defvar tramp-remote-process-environment)
  (declare-function tramp-get-connection-process "tramp" (vec))
  (let* ((tramp-remote-process-environment
          (append extraenv tramp-remote-process-environment)))
    (when (tramp-get-connection-process vec)
      ;; For already existing connections, the new exec path must
      ;; be re-set, otherwise it won't take effect.  One example
      ;; of such case is when remote dir-locals are read and
      ;; *then* subprocesses are triggered within the same
      ;; connection.
      (python-shell-tramp-refresh-remote-path
       ;; FIXME: This is still Python-specific.
       vec (python-shell-calculate-exec-path))
      ;; The `tramp-remote-process-environment' variable is only
      ;; effective when the started process is an interactive
      ;; shell, otherwise (like in the case of processes started
      ;; with `process-file') the environment is not changed.
      ;; This makes environment modifications effective
      ;; unconditionally.
      (python-shell-tramp-refresh-process-environment
       vec tramp-remote-process-environment))
    (funcall bodyfun)))