5

On Emacs, when I start python with C-c ! while editing a remote python file (using tramp - plinkx: on windows), the python interpreter is started on the remote host.

Is there any way I can edit the remote python file and start a local python interpreter?

I am using python-mode (not the default python.el)

1 Answer 1

1

python-mode creates an inferior process via 'make-comint, which uses 'start-file-process, which creates the process relative to the variable 'default-directory. So there are a few ways you can tackle this beast.

The first is to change 'default-directory to be something local, like:

(add-hook 'python-mode-hook (lambda () (setq default-directory "~"))

That has the downside that C-x C-f now behaves differently (starting at ~).

Another is to change the 'default-directory just for the invocation of 'py-shell, like so (untested):

(defadvice py-shell (around py-shell-different-directory activate)
  "set default-directory just for py-shell"
  (let ((default-directory "~"))
    ad-do-it))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.