i can execute a highlighted region, but is there a command to execute a single line? without C-space to highlight it.
any ideas?
I am assuming you are using python.el that ships with Emacs. As far as I know the mode does not define a command to execute a single line. But we can easily define a command to do so. Below is my attempt to define such a command
(defun python-send-line ()
(interactive)
(save-excursion
(back-to-indentation)
(python-shell-send-string (concat (buffer-substring-no-properties (point)
(line-end-position))
"\n"))))
If you are using python-mode.el, it does have a command named py-execute-line which according to docstring
Send current line from beginning of indent to Python interpreter.
python.elthat comes with emacs?