emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Babel: Call A when executing B


From: Thomas S. Dye
Subject: Re: [O] Babel: Call A when executing B
Date: Sun, 22 Feb 2015 07:04:42 -1000

Aloha Ken,

I'm not sure what you mean by "anything else of that type", but
executing a named code block in other code blocks can be achieved with
the noweb syntax.

#+name: packages-that-make-iPython-great
#+begin_src python
import numpy as np
import foo as bar
...
#+end_src

#+header: :noweb yes
#+begin_src python
<<packages-that-make-iPython-great>>
...
#+end_src

hth,
Tom

Ken Mankoff <address@hidden> writes:

> I'd like to have some language specific code (either a code block in the
> Library of Babel, in the current file, embedded in elisp in my startup
> file, wherever) run each time I execute any code block. Is there a way
> to specify this via header arguments, or :prologue, or anything else of
> that type?
>
> Reason: Org python Babel configured to work with IPython works great,
> but has some limitations, such as src_python{} calls not working. I
> think one way to fix this is to have babel run with python, not IPython,
> but then pre-load all the packages that make IPython great.
>
> To be specific, how can I executed "import numpy as np" each time I "C-c
> C-c" on a "+#BEGIN_SRC python" code block?
>
> Thanks,
>
>   -k.
>   
>
>

-- 
Thomas S. Dye
http://www.tsdye.com



reply via email to

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