]> git.eshelyaron.com Git - emacs.git/commit
python.el: Try and better split the Tramp code
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 4 Feb 2022 18:35:21 +0000 (13:35 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 4 Feb 2022 18:35:38 +0000 (13:35 -0500)
commitd340dc0a256db979c617bd5ee06dafa5a52791f5
tree3bc7de8ee06f91ee0d1b135f354ecdee03fb6491
parentf88d4e424877c5709bb49d7d905004dea06ce089
python.el: Try and better split the Tramp code

Massage the Python-Tramp code so that the Tramp part and the Python
part are a bit less intertwined.  It's still not quite right, but it's
a bit closer to the point where the Tramp part can be moved to `tramp.el`.

* lisp/progmodes/python.el: Don't require `tramp-sh`.
Do require `subr-x` OTOH.  Remove redundant `:group`s.
(python-shell--calculate-process-environment): New function, that only
return the entries to be added.
(python-shell-calculate-process-environment): Rewrite and declare obsolete.
(python-shell-tramp-refresh-remote-path)
(python-shell-tramp-refresh-process-environment): Silence
compiler warnings.
(python-shell-with-environment): Move the bulk of its code to
a new function `python-shell--with-environment` for easier debugging
and to avoid code duplication.
(python-shell--with-environment): New function.  Split the Tramp case
into its own function.
(python-shell--tramp-with-environment): New function.
(python-eldoc-function-timeout-permanent): Fix doc's first line.

* test/lisp/progmodes/python-tests.el: Adjust accordingly.
(python-shell-calculate-process-environment-1)
(python-shell-calculate-process-environment-2)
(python-shell-calculate-process-environment-3)
(python-shell-calculate-process-environment-4)
(python-shell-calculate-process-environment-5)
(python-shell-calculate-process-environment-6)
(python-shell-calculate-process-environment-7)
(python-shell-calculate-process-environment-8):
Use `python-shell--calculate-process-environment`.
(python--tests-process-env-canonical, python--tests-process-env-eql):
New functions.
(python-shell-with-environment-2, python-shell-with-environment-3):
Use them.
lisp/progmodes/python.el
test/lisp/progmodes/python-tests.el