emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] «Macro» expansion in source blocks; code-sharing between blocks


From: Eric S Fraga
Subject: Re: [O] «Macro» expansion in source blocks; code-sharing between blocks
Date: Thu, 18 Sep 2014 15:01:37 +0100

On Thursday, 18 Sep 2014 at 13:26, Tobias Getzner wrote:
> On Thu, 18 Sep 2014 13:17:14 +0000, Tobias Getzner wrote:
>
>> Are there any convenient inline-expansion methods I might have
>> overlooked?
>
> To illustrate, I was wondering if any of the following is feasible 
> somehow:

Yes, and you almost got it right with your syntactic expansion:

#+begin_src org

  ,* Syntactic expansion

  ,#+name: setup_fu
  ,#+begin_src sh :noweb yes
    echo 2
  ,#+end_src

  ,#+begin_src sh :results raw :noweb yes
    echo 1
    <<setup_fu>>
    echo 3
  ,#+end_src

  ,#+results:
  1
  2
  3

#+end_src

Org src blocks can reference other src blocks.  Note the ":noweb yes"
option and the use of <<...>>.


-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.1, Org release_8.3beta-366-gb2fca7

Attachment: signature.asc
Description: PGP signature


reply via email to

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