From mboxrd@z Thu Jan 1 00:00:00 1970 From: Puneeth Chaganti Subject: Re: babel: using empty lines in python code while using session Date: Fri, 23 Jan 2015 20:41:55 +0530 Message-ID: References: <531E5A4F.701@lbl.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEfuL-00086a-Jf for emacs-orgmode@gnu.org; Fri, 23 Jan 2015 10:12:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEfuE-0005Vo-Pe for emacs-orgmode@gnu.org; Fri, 23 Jan 2015 10:12:25 -0500 Received: from mail-we0-x22a.google.com ([2a00:1450:400c:c03::22a]:35246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEfuE-0005Va-Jc for emacs-orgmode@gnu.org; Fri, 23 Jan 2015 10:12:18 -0500 Received: by mail-we0-f170.google.com with SMTP id x3so8119636wes.1 for ; Fri, 23 Jan 2015 07:12:15 -0800 (PST) In-Reply-To: <531E5A4F.701@lbl.gov> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Arun Persaud Cc: emacs-orgmode On Tue, Mar 11, 2014 at 6:05 AM, Arun Persaud 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) -------------------