Jarmo Hurri <jarmo.hu...@iki.fi> writes: > Greetings. > > I have a very basic Babel question, but I can not extract the solution > from the manual. > > I have a language-specific function - in this case Asymptote, but it > could be e.g. C as well - that I want to use in a number of different > source blocks of the same language in an Org file. How do I accomplish > this? > > Currently my solution is to write the function into an external source > file, and include the file in the source blocks. But that looks ugly, > and is sort of against the Org-mode way of doing things: all code in the > same place for completeness and convenience. > > How can I achieve what I want?
try something like this: #+NAME: foo #+BEGIN_SRC emacs-lisp (defun foo (x) (+ x 2)) #+END_SRC #+results: foo : foo #+BEGIN_SRC emacs-lisp :var fun=foo (funcall (intern fun) 3) #+END_SRC #+results: : 5 -- cheers, Thorsten