emacs-orgmode
[Top][All Lists]
Advanced

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

Using a code block as input to another code block


From: Magnus Therning
Subject: Using a code block as input to another code block
Date: Sat, 21 Nov 2020 23:30:19 +0100
User-agent: mu4e 1.4.13; emacs 27.1

I know I can use an example block (literal example) as input to a code
block, but I haven't found a way to fontify examples. Since my input is
code (JSON, and various programming languages) I would really like to
have that, as well as the language's mode when editing by using
~org-edit-source-code~.

A code block gives me fontification, but I haven't found a way to pass a
code block as is to another code block.

For instance, something like this:

#+name: code-input
#+begin_src C
#include <foo.h>
#+end_src

#+begin_src bash :var input=input :results verbatim
cat <<EOF | cpp
${input}
EOF
#+end_src

What are my options? I hope there's either a way to fontify an example,
or to override the default execute function for a code block, or
something else that I'm not thinking of.

/M

--
Magnus Therning              OpenPGP: 0x927912051716CE39
email: magnus@therning.org
twitter: magthe              http://magnus.therning.org/

I am always doing that which I cannot do, in order that I may learn
how to do it.
     — Pablo Picasso

Attachment: signature.asc
Description: PGP signature


reply via email to

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