Hi On 12/03/2013 03:44 AM, Rasmus wrote: >> [ipython in org mode] > For Org you could do: > > (setq org-babel-python-command "ipython --no-banner --classic > --no-confirm-exit") > > You should now be able to do > > #+BEGIN_SRC python :results output > %timeit 1+1 > #+END_SRC >[...]
nice ;) that works well for me. Thanks! Since I now have ipython as an interpreter, is there a way to have org mode use %cpaste to copy the code into the python buffer? That way empty lines would be handled correctly, e.g. #+BEGIN_SRC python :results output :session for i in range(2): print(i) print("next") print("done") #+END_SRC would work. I got it to work using something like this ; use %cpaste to paste code into ipython in org mode (defadvice org-babel-python-evaluate-session (around org-python-use-cpaste (session body &optional result-type result-params) activate) "add a %cpaste and '--' to the body, so that ipython does the right thing." (setq body (concat "%cpaste\n" body "\n--")) ad-do-it (setq ad-return-value (replace-regexp-in-string "\\(^Pasting code; enter '--' alone on the line to stop or use Ctrl-D\.[\r\n]:*\\)" "" ad-return-value))) I also put a request in to have a %cpaste -q option to suppress output. But I'm wondering if there is a better way of doing this... thanks again Arun