From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Buffer-wide definitions in org-babel Date: Wed, 07 Oct 2009 12:48:40 -0600 Message-ID: References: <55bd243d0910070720i3085af58xc30cf14011d6375a@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvbZD-0002JO-9l for emacs-orgmode@gnu.org; Wed, 07 Oct 2009 14:48:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvbZ8-0002GD-E0 for emacs-orgmode@gnu.org; Wed, 07 Oct 2009 14:48:50 -0400 Received: from [199.232.76.173] (port=56290 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvbZ8-0002G8-7V for emacs-orgmode@gnu.org; Wed, 07 Oct 2009 14:48:46 -0400 Received: from mail-px0-f202.google.com ([209.85.216.202]:47086) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MvbZ7-0000lk-Ql for emacs-orgmode@gnu.org; Wed, 07 Oct 2009 14:48:46 -0400 Received: by pxi40 with SMTP id 40so5490250pxi.24 for ; Wed, 07 Oct 2009 11:48:44 -0700 (PDT) In-Reply-To: <55bd243d0910070720i3085af58xc30cf14011d6375a@mail.gmail.com> (Juan Reyero's message of "Wed, 7 Oct 2009 16:20:04 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Juan Reyero Cc: emacs-orgmode@gnu.org Juan Reyero writes: > Greetings, > Hi, > > I am trying to define buffer-wide initializations in org-babel, so that I= can import a python module once > and then use its exported symbols in all the code chunks throughout the b= uffer. =C2=A0Is there a way to do it? > =C2=A0I have tried all the obvious approaches and none seems to work. =C2= =A0(My hope was that I could define a > :session and then use it in every chunk, but python doesn't like it).=C2= =A0 > I believe you are on the right track by trying to use sessions. The following works for me --8<---------------cut here---------------start------------->8--- ** persistent python #+begin_src python :session :results silent import types #+end_src #+begin_src python :session types.FunctionType #+end_src #+resname: : function --8<---------------cut here---------------end--------------->8--- Of if you grab the latest version of Org-mode from the git repo you can set the session type in a headline property which would be more similar to the file-wide behavior that you described. --8<---------------cut here---------------start------------->8--- *** more persistent python :PROPERTIES: :session: default :END: #+begin_src python :results silent import types #+end_src #+begin_src python types.FunctionType #+end_src #+resname: : function --8<---------------cut here---------------end--------------->8--- please let me know if the above don't work for you, or if you are encountering some other python-babel issues. > > I just found out about org-babel, and I am delighted by its promise. Thanks! I hope it lives up it's promise. Best -- Eric > Org-mode has changed the way I work (after a year and a half I could > not live without it) but now I think this is going to be another bit > step.=C2=A0 > > Many thanks, > > jm > -- > http://juanreyero.com/blog > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode