emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Babel: reusing language-specific functions


From: Jarmo Hurri
Subject: Re: [O] Babel: reusing language-specific functions
Date: Thu, 09 Oct 2014 08:23:47 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

address@hidden (Thomas S. Dye) writes:

>> Jarmo Hurri <address@hidden> 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

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