I like the python-send-buffer command, however I very often use Python built-in to applications, or run Python through a custom package management system (to run Python with certain dependencies). In other words, I can't just run "python" and get a useful Python instance (what python-send-buffer relies on)
I would like to achieve:
- in any Python interpreter (or application that allows you to evaluate Python code), import the
magic_emacs_python_server.py module (add sys.path if necessary) - In emacs, run
magic-emacs-python-send-buffer
This will evaluate the buffer in the remote Python instance.
It seems like it should be pretty simple - the Python module listens on the socket in the stream. It is evaluated in the main thread and returns repr() result (or, possibly, captures stdout / stderr, or, possibly, both). The emacs module simply sends the text to the socket, waits for the response line, and displays it in the buffer.
It sounds so simple, something like this should already exist ... IPython has ipy_vimserver , but it is not. There is also swank , although it seems very Lisp-specific, there is a Javascript backend that is very similar to what I want .. but the search finds almost nothing, except for some vague (possibly true) statements that SLIME does not work well with non-w131> languages
In short:
- Is there a project to send code from an emacs buffer to an existing Python process?
- If not, how would you recommend writing such a thing (you are not very familiar with elisp) - SWANK? IPython server code? Simple TCP server from scratch?
source share