* Babel: Call A when executing B
@ 2015-02-22 14:54 Ken Mankoff
2015-02-22 17:04 ` Thomas S. Dye
0 siblings, 1 reply; 2+ messages in thread
From: Ken Mankoff @ 2015-02-22 14:54 UTC (permalink / raw)
To: Org-mode
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Babel: Call A when executing B
2015-02-22 14:54 Babel: Call A when executing B Ken Mankoff
@ 2015-02-22 17:04 ` Thomas S. Dye
0 siblings, 0 replies; 2+ messages in thread
From: Thomas S. Dye @ 2015-02-22 17:04 UTC (permalink / raw)
To: Ken Mankoff; +Cc: Org-mode
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 <mankoff@gmail.com> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-22 17:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-22 14:54 Babel: Call A when executing B Ken Mankoff
2015-02-22 17:04 ` Thomas S. Dye
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).