From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arun Persaud Subject: Babel python question: use of ipython and %cpaste Date: Mon, 02 Dec 2013 22:08:06 -0800 Message-ID: <529D7546.3080500@lbl.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vnj9j-0005uk-Sn for emacs-orgmode@gnu.org; Tue, 03 Dec 2013 01:08:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vnj9b-0006vL-QC for emacs-orgmode@gnu.org; Tue, 03 Dec 2013 01:08:23 -0500 Received: from fe2.lbl.gov ([128.3.41.134]:43221) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vnj9b-0006tw-Ji for emacs-orgmode@gnu.org; Tue, 03 Dec 2013 01:08:15 -0500 Received: by mail-yh0-f44.google.com with SMTP id f64so9895208yha.31 for ; Mon, 02 Dec 2013 22:08:07 -0800 (PST) Received: from [192.168.1.64] (107-217-189-84.lightspeed.sntcca.sbcglobal.net. [107.217.189.84]) by mx.google.com with ESMTPSA id f78sm3238296yhp.12.2013.12.02.22.08.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Dec 2013 22:08:07 -0800 (PST) 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: emacs-orgmode Hi being able to use python as a source block is great, but I often stumble over the fact that when using sessions you have to treat empty lines in a special way (i.e. as the end of an indentation block). I was wondering if it would be easy to create an ipython mode, something like #+BEGIN_SRC ipython ... where the content for a session is copied over to an ipython buffer using the ipython magic %cpaste. This way empty lines should be treated correctly. It would also have the nice side effect of giving access to other magic commands within org-babel, such as %timeit or profiling. Unfortunately, I don't know how to modify ob-python.el to achieve this. Apart from setting py-shell, I'm not sure how to copy the body of the source block over to use %cpaste and also how to create a trigger for BEGIN_SRC ipython... Would this work? Any idea on how to implement this? Thanks Arun