Note that there are some explanatory texts on larger screens.

plurals
  1. POIPython in Emacs. Quick code evaluation
    text
    copied!<p><strong>Update</strong>: The question still lacks a satisfactory answer. </p> <p>I would like to "send" code snippets to a IPython interpreter in Emacs 23.2 (Linux). Assuming that I have already started an IPython shell in a buffer in Emacs (e.g. using <code>Python-mode.el</code> and <code>IPython.el</code>), is there a way of selecting a region in a different buffer and "sending" this region to the already-started IPython shell?</p> <p>I have tried <code>C-c C-c</code> (send-buffer-to-shell) and <code>C-c |</code> (send-region-to-shell), but <strong>this only works as long as the code is written in Python and not in IPython</strong> (IPython can run Python code). The reason seems to be that, for both commands, Emacs creates a temporary file with <code>.py</code> extension (as opposed to with <code>.ipy</code> extension), which then is interpreted by IPython as "Python-specific code". This prevents me from using IPython-specific features such as magic commands.</p> <p>On a separate note, I have also read that Emacs provides <code>M-| ('shell-command-on-region')</code> to run selected regions in a shell. To do this with an IPython interpreter, I have tried setting <code>shell-file-name</code> to my IPython path. However, when I run <code>M-|</code> after selecting a region, Emacs prompts me the following:</p> <blockquote> <p>Shell command on region:</p> </blockquote> <p>and if I then type <code>RET</code>, I get the IPython man page on the <code>*Shell Command Output*</code> buffer, without the region being executed. Is there any IPython-specific command that I can use for <code>M-| ('shell-command-on-region')</code> to get IPython run my code?</p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload