4 ms·
I patched python-mode to do this (also did something similar for node and a few other interpreters). Main thing is to add a "py-execute-line" routine and a few
by ramanujan 14y ago
I patched python-mode to do this (also did something similar for node and a few other interpreters). Main thing is to add a "py-execute-line" routine and a few others as wrappers around the file execution code. If there's interest, might post as open source.
EDIT: here is a snippet
(defun py-execute-line (&optional async)
"Send the current line to the inferior python process using py-execute-region."
(interactive "P")
(save-excursion
(end-of-line)
(let ((end (point)))
(beginning-of-line)
(py-execute-region (point) end async)))
)
That's the py-execute-line function, which is sending code to py-execute-region defined in python-mode (http://bazaar.launchpad.net/~python-mode-devs/python-mode/python-mode/view/head:/python-mode.el#L7828 http://bazaar.launchpad.net/~python-mode-devs/python-mode/py...).
For some reason the default python mode in emacs is python.el rather than python-mode.el. So you probably want to start by using python-mode.