From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: including the result of a block in several places? Date: Tue, 11 Dec 2012 08:48:40 +0100 Message-ID: References: , <8038zh3eil.fsf@somewhere.org>, , , , <80a9tmrzz4.fsf@somewhere.org>, , <871ueyaqio.fsf@gmail.com>, , Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiKa3-00065R-JJ for emacs-orgmode@gnu.org; Tue, 11 Dec 2012 02:48:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TiKa2-0003s0-Dg for emacs-orgmode@gnu.org; Tue, 11 Dec 2012 02:48:43 -0500 Received: from mail1-relais-roc.national.inria.fr ([192.134.164.82]:55391) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiKa2-0003rr-6o for emacs-orgmode@gnu.org; Tue, 11 Dec 2012 02:48:42 -0500 In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode Thomas S. Dye writes: > Alan Schmitt writes: > >> Eric Schulte writes: >> >>> Alan Schmitt writes: >>> >>>> "Sebastien Vauban" 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