I recently started using emacs to code in Python. I currently prefer to use python mode (defined in python.el) alongside ansi-term for the python interactive shell. I'm trying to change the behavior of C-c C-c in python mode so it sends the buffer into ansi-term to be executed. That is, I'd like it to act as if I wrote 'execfile([current .py file i'm working on])' in the ansi-term.
Is there a way to do this? If not specifically through C-c C-c, with some other shortcut/method?
*term
* already running Python interpreter, then(let ((f (buffer-file-name))) (with-current-buffer "*term*" (insert (format "execfile(['%s'])" f) (term-send-input)))
, and then bind this to whatever key you want. – wvxvw Jan 4 '16 at 6:17