emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mike Gauland <mikelygee@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Using a code block as input to another code block
Date: Mon, 23 Nov 2020 10:50:03 +1300	[thread overview]
Message-ID: <d397746d-cc63-2b50-02b0-f58a8952c598@gmail.com> (raw)
In-Reply-To: <87d006z6kl.fsf@therning.org>

As far as I know, referencing a code block this way uses the results of 
executing the block as the variable, not the contents of the block.

On 22/11/2020 11:30 am, Magnus Therning wrote:
> 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


      parent reply	other threads:[~2020-11-22 21:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-21 22:30 Using a code block as input to another code block Magnus Therning
2020-11-22 17:26 ` Berry, Charles via General discussions about Org-mode.
2020-11-23 11:39   ` Magnus Therning
2020-11-22 21:50 ` Mike Gauland [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d397746d-cc63-2b50-02b0-f58a8952c598@gmail.com \
    --to=mikelygee@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).