I've got the following code:

#+NAME: example-block1
Lorem ipsum dolor sit amet, consectetur adipisicing elit.

#+NAME: example-block2
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

#+NAME: my-shell-block
#+BEGIN_SRC sh :stdin example-block2

#+CALL: my-shell-block()

Calling the "my-shell-block" with a hardcoded :stdin reference is no problem.

But now I want to set the :stdin dynamically in another "CALL":

#+CALL: my-shell-block(:stdin=example-block1)

This obviously does not work. Is there a way to dynamically change the ":stdin" of a shell code block?


:stdin isn't a argument as far as a function call is concerned. It's a special header argument which uses a slightly funky #+CALL syntax. Try:

#+CALL: my-shell-block[:stdin example-block1]()

Depending on your results setting you might want to force it to take output so it doesn't listify your results:

#+CALL: my-shell-block[:stdin example-block1 :results output]()

: Lorem ipsum dolor sit amet, consectetur adipisicing elit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.