emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Puneeth Chaganti <punchagan@gmail.com>
To: Arun Persaud <apersaud@lbl.gov>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: babel: using empty lines in python code while using session
Date: Fri, 23 Jan 2015 20:41:55 +0530	[thread overview]
Message-ID: <CALnw1fS6jHOQbnJGQNto4n_w4jCAFLSreBgvix=k6CeEe=U3uQ@mail.gmail.com> (raw)
In-Reply-To: <531E5A4F.701@lbl.gov>

On Tue, Mar 11, 2014 at 6:05 AM, Arun Persaud <apersaud@lbl.gov> 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	other threads:[~2015-01-23 15:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11  0:35 babel: using empty lines in python code while using session Arun Persaud
2015-01-23 15:11 ` Puneeth Chaganti [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALnw1fS6jHOQbnJGQNto4n_w4jCAFLSreBgvix=k6CeEe=U3uQ@mail.gmail.com' \
    --to=punchagan@gmail.com \
    --cc=apersaud@lbl.gov \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).