Re:Bpython is a fancy interface to the Python interpreter
by ramanujan on Sunday May 20, 2012 @09:01PM
(#4000794)
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)))
)
EDIT: here is a snippet
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/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.