Update . The question is still not satisfactory.
I would like to βsendβ code snippets to the IPython interpreter in Emacs 23.2 (Linux). Assuming that I have already started the IPython shell in a buffer in Emacs (for example, using Python-mode.el and IPython.el ), is there a way to select a region in another buffer and "send" this region to the already running IPython shell?
I tried Cc Cc (send-buffer-to-shell) and Cc | (send-region-to-shell), but this only works as long as the code is written in Python and not in IPython (IPython can run Python code). The reason is that for both commands, Emacs creates a temporary file with the extension .py (as opposed to the extension .ipy ), which IPython then interprets as "Python-specific code." This prevents me from using IPython-specific functions such as magic commands.
In a separate note, I also read that Emacs provides M-| ('shell-command-on-region') M-| ('shell-command-on-region') to run selected areas in the shell. To do this using the IPython interpreter, I tried setting the shell-file-name to my IPython path. However, when I run M-| after selecting an area, Emacs offers me the following:
Shell command in the area:
and if I then type RET , I get the IPython man page in the *Shell Command Output* buffer without executing the scope. Is there any IPython-specific command that I can use for M-| ('shell-command-on-region') M-| ('shell-command-on-region') to get IPython to run my code?
Thanks!
python shell emacs ipython
Amelio vazquez-reina
source share