emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] including the result of a block in several places?


From: Alan Schmitt
Subject: Re: [O] including the result of a block in several places?
Date: Tue, 11 Dec 2012 08:48:40 +0100
User-agent: mu4e 0.9.9.5-dev4; emacs 24.2.1

Thomas S. Dye writes:

> Alan Schmitt <address@hidden> writes:
>
>> Eric Schulte writes:
>>
>>> Alan Schmitt <address@hidden> writes:
>>>
>>>> "Sebastien Vauban" <address@hidden> writes:
>>>>
>>>>> In a hurry, to repeat the code:
>>>>>
>>>>> - use named blocks
>>>>> - use Noweb expansion
>>>>>
>>>
>>> Another option would be,
>>>
>>> 1. use named blocks
>>> 2. use call lines
>>
>> Thanks for the suggestion. I tried using a call line, but it does not
>> allow me to include the source code again (it's great to re-run the code
>> once more, though).
>
> What call line did you try?

This is what I tried

#+begin_src org
** Prototype-based objects

#+name: object_example
#+begin_src js :results code output :exports both
var f = function(a) {
        this.x = a
}

f.prototype = {y : 1}

var o = new f (42)

console.log("o.x = " + o.x + ", o.y = " + o.y)
#+end_src

Results

#+results: object_example

** Prototypes resolution

Some other slide

** Prototype-based objects

#+call: echo(object_example) :results code output :exports both
#+end_src

My problem with this was twofold: the code from "object_example" is
not repeated, and the highlighting of the results in the "#+call:"
line is not in javascript syntax.

Using a "noweb" approach solves both issues.

Alan



reply via email to

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