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: Grant Rettke
Subject: Re: [O] Babel: reusing language-specific functions
Date: Thu, 9 Oct 2014 21:11:51 -0500

That is a great option when you want to run *without* a session.

That is also a nice approach when you are using plantuml and do not
want to use a single external file
and include it all over the place.

On Thu, Oct 9, 2014 at 12:23 AM, Jarmo Hurri <address@hidden> wrote:
> 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
>
>



-- 
Grant Rettke
address@hidden | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson



reply via email to

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