[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] including the result of a block in several places?
From: |
Sebastien Vauban |
Subject: |
Re: [O] including the result of a block in several places? |
Date: |
Mon, 10 Dec 2012 10:57:51 +0100 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (windows-nt) |
Alan Schmitt,
Alan Schmitt wrote:
> address@hidden (Thomas S. Dye) writes:
>
>> I've had these in my .emacs for quite a while and they seem to work:
>>
>> ** ON Load Standard Library of Babel
>> #+begin_src emacs-lisp :tangle yes
>> (org-babel-lob-ingest
>> "~/.emacs.d/src/org-mode/contrib/babel/library-of-babel.org")
>> #+end_src
>
> Thanks a lot, I'm now able to call the "echo" function.
>
> Unfortunately it does not exactly do what I want (but I was not really
> clear about what I wanted first). Here is the code I have (don't worry
> about the code inside the blocks, the idea is that I want a source block
> and its results on two different slides, without having to duplicate
> them):
>
> #+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
>
> #+BEGIN_SRC coq
> Inductive proto : heap -> field -> loc -> loc -> Prop :=
> | proto_null : forall h f,
> proto h f loc_null loc_null
> | proto_here : forall h l f,
> indom h l f ->
> proto h f l l
> | proto_next : forall h l f l' l'',
> ~ indom h l f ->
> binds h l field_proto l' ->
> proto h f l' l'' ->
> proto h f l l''.
> #+END_SRC
>
> ** Prototype-based objects
>
> #+call: echo(object_example) :results code output :exports both
> #+end_src
>
> My problem is twofold.
> - The code from "object_example" is not repeated. I guess that here what
> I want is to be able to export a source code block in several places. Is
> it possible?
> - The highlighting of the results in the "#+call:" line is not in
> javascript syntax, and I don't know how to tell the call that the result
> will be javascript.
In a hurry, to repeat the code:
- use named blocks
- use Noweb expansion
That is:
#+name: mycode
#+begin_src coq
...
#+end_src
Inserted a first time here:
#+begin_src coq :noweb yes
<<mycode>>
#+end_src
and another one here:
#+begin_src coq :noweb yes
<<mycode>>
#+end_src
Best regards,
Seb
--
Sebastien Vauban
- [O] including the result of a block in several places?, Alan Schmitt, 2012/12/07
- Re: [O] including the result of a block in several places?, Sebastien Vauban, 2012/12/07
- Re: [O] including the result of a block in several places?, Alan Schmitt, 2012/12/08
- Re: [O] including the result of a block in several places?, Thomas S. Dye, 2012/12/08
- Re: [O] including the result of a block in several places?, Alan Schmitt, 2012/12/10
- Re: [O] including the result of a block in several places?,
Sebastien Vauban <=
- Re: [O] including the result of a block in several places?, Alan Schmitt, 2012/12/10
- Re: [O] including the result of a block in several places?, Eric Schulte, 2012/12/10
- Re: [O] including the result of a block in several places?, Alan Schmitt, 2012/12/10
- Re: [O] including the result of a block in several places?, Alan Schmitt, 2012/12/10
- Re: [O] including the result of a block in several places?, Thomas S. Dye, 2012/12/10
- Re: [O] including the result of a block in several places?, Alan Schmitt, 2012/12/11