emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Org + Elpy Python + IPython


From: Ken Mankoff
Subject: Re: [O] Org + Elpy Python + IPython
Date: Tue, 20 May 2014 16:23:12 -0400
User-agent: mu4e 0.9.9.6pre3; emacs 24.3.1

And with a bit more work (and help from others) I have it working.

IPython, Org, Elpy, session or no-session. Still cannot set
(elpy-use-ipython) which makes the IPython sessions a bit less awesome
(no popup help, for example). But everything else appears to work.

(setq org-babel-python-command "ipython --pylab=osx --pdb --nosep --classic 
--no-banner --no-confirm-exit")

;; https://github.com/jorgenschaefer/elpy/issues/191
;; https://lists.gnu.org/archive/html/emacs-orgmode/2014-03/msg00405.html
;; make IPython work w/ Org
(defadvice org-babel-python-evaluate
  (around org-python-use-cpaste
          (session body &optional result-type result-params preamble) activate)
  "Add a %cpaste and '--' to the body, so that ipython does the right thing."
  (setq body (concat "%cpaste -q\n" body "\n--\n"))
  ad-do-it
  (if (stringp ad-return-value)
      (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))))


 -k.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]