emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Buffer-wide definitions in org-babel


From: Eric Schulte
Subject: Re: [Orgmode] Buffer-wide definitions in org-babel
Date: Wed, 07 Oct 2009 13:17:58 -0600
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (darwin)

Hi,

This brings up a need for further Org-babel development.

As you described below the :session environment can be used to deal with
the need for required "stage setting" source-code blocks, however there
is currently no way when directly executing a block to specify that some
other block in the same session must be evaluated first to setup the
environment.

Perhaps a new header argument named :requires would be useful here.
This would allow any block to "require" that some other named
source-code block be prepended to it's self before evaluation.

I'll add this as a task to the Org-babel development file.

Thanks for helping to point out this need.

Best -- Eric

"Eric Schulte" <address@hidden> writes:

> Juan Reyero <address@hidden> 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 
>> buffer.  Is there a way to do it?
>>  I have tried all the obvious approaches and none seems to work.  (My hope 
>> was that I could define a
>> :session and then use it in every chunk, but python doesn't like it). 
>>
>
> I believe you are on the right track by trying to use sessions.  The
> following works for me
>
> ** persistent python
> #+begin_src python :session :results silent
>   import types
> #+end_src
>
> #+begin_src python :session
>   types.FunctionType
> #+end_src
>
> #+resname:
> : function
>
> 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.
>
> *** 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
>
> 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. 
>>
>> Many thanks,
>>
>> jm
>> --
>> http://juanreyero.com/blog
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> address@hidden
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode




reply via email to

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