emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to call a source code block from another one
@ 2017-03-08 11:20 Marcin Borkowski
  2017-03-08 12:21 ` Rasmus
  0 siblings, 1 reply; 3+ messages in thread
From: Marcin Borkowski @ 2017-03-08 11:20 UTC (permalink / raw)
  To: Org-Mode mailing list

Hi all,

and sorry if this is trivial, but I didn't find it in the manual.

Assume that I have a few source code blocks (in my case, in bash) and
I want to call them in sequence.  Is it possible to write another,
"master" source code block which would then call those previous blocks?

Best,

--
Marcin Borkowski

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to call a source code block from another one
       [not found] <1ed163077135431daf64f84c2bd6ac4b@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2017-03-08 11:46 ` Eric S Fraga
  0 siblings, 0 replies; 3+ messages in thread
From: Eric S Fraga @ 2017-03-08 11:46 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 722 bytes --]

On Wednesday,  8 Mar 2017 at 11:20, Marcin Borkowski wrote:
> Hi all,
>
> and sorry if this is trivial, but I didn't find it in the manual.
>
> Assume that I have a few source code blocks (in my case, in bash) and
> I want to call them in sequence.  Is it possible to write another,
> "master" source code block which would then call those previous blocks?

You could use noweb to include other code blocks in a master one.
You reference other src blocks using <<other-block-name>>.

e.g.
#+begin_src shell :noweb yes
<<block1>>
<<block2>>
#+end_src

where block1 and block2 are shell src blocks as well.

HTH,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_9.0.3-241-gc3d67b

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to call a source code block from another one
  2017-03-08 11:20 How to call a source code block from another one Marcin Borkowski
@ 2017-03-08 12:21 ` Rasmus
  0 siblings, 0 replies; 3+ messages in thread
From: Rasmus @ 2017-03-08 12:21 UTC (permalink / raw)
  To: emacs-orgmode

Marcin Borkowski <mbork@mbork.pl> writes:

> Hi all,
>
> and sorry if this is trivial, but I didn't find it in the manual.
>
> Assume that I have a few source code blocks (in my case, in bash) and
> I want to call them in sequence.  Is it possible to write another,
> "master" source code block which would then call those previous blocks?

Couldn't you use ob noweb for that?

    http://orgmode.org/org.html#noweb

The example here might be close to what you want, if I understand
correctly,

    http://orgmode.org/org.html#noweb_002dref

Hope it helps,
Rasmus

-- 
There are known knowns; there are things we know that we know

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-08 13:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-08 11:20 How to call a source code block from another one Marcin Borkowski
2017-03-08 12:21 ` Rasmus
     [not found] <1ed163077135431daf64f84c2bd6ac4b@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-03-08 11:46 ` Eric S Fraga

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).