t...@tsdye.com (Thomas S. Dye) writes:

>> Jarmo Hurri <jarmo.hu...@iki.fi> writes:
>>> 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?
> Or, perhaps use the noweb syntax.
>
>
> #+NAME: foo
> #+BEGIN_SRC emacs-lisp
>   (defun foo (x) (+ x 2))
> #+END_SRC
>
> #+results: foo
> : foo
> #+begin_src emacs-lisp :noweb yes
> <<foo>>
> (foo 3)
> #+end_src
>
> #+results:
> : 5

Yes, this is a perfect solution. You can use noweb to include any code
block, not only function definitions. Thanks!

Jarmo


Reply via email to