emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] babel: using empty lines in python code while using session


From: Puneeth Chaganti
Subject: Re: [O] babel: using empty lines in python code while using session
Date: Fri, 23 Jan 2015 20:41:55 +0530

On Tue, Mar 11, 2014 at 6:05 AM, Arun Persaud <address@hidden> wrote:
> Hi
>
> I started using python in org babel. The manual, for example [1], points
> to the fact that in session mode you can't have empty lines, since they
> will be interpreted differently. However, if you use ipython you can get
> around this, by using the following in your .emacs:

This is great!  Thanks for investigating this, and letting us all
know!  `%cpaste -q` is great!

The advice function required now is much smaller.  Adding it below, in
case anyone else finds it useful.

-------------------

(defun pc/ipython-use-cpaste (args)
  "Add a %cpaste and '--' to the body, for IPython magic!."
  (let ((body (nth 1 args)))
    (setcar (cdr args) (format "%%cpaste -q\n%s\n--\n" body))))

(advice-add 'org-babel-python-evaluate-session
            :filter-args 'pc/ipython-use-cpaste)

-------------------



reply via email to

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