emacs-orgmode
[Top][All Lists]
Advanced

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

How to make org-babel expand <<noweb>> but _not_ evaluate the code fed i


From: Vladimir Nikishkin
Subject: How to make org-babel expand <<noweb>> but _not_ evaluate the code fed into another block?
Date: Mon, 17 Feb 2020 16:46:18 +0800

Hello, everyone!

What I want to do is roughly the following:

#+name: for-expansion
#+begin_src scheme
(display "hello world\n")
#+end_quote

#+name: for-input
#+begin_src scheme
(import (srfi 27))
<<for-expansion>>
#+end_src

#+name: block-in-question
#+begin_src shell :shebang "#! /usr/bin/chibi-scheme" :results output :stdin for-input
(eval (read))
#+end_src

At the moment this doesn't work, because babel _evaluates_ for-input before feeding it into the next block. It is also not possible to make the "for-input" block a +begin_quote block, because then <<noweb>> syntax doesn't get expanded.

At the moment I am getting around it the following way:

#+name: for-expansion
#+begin_src scheme
(display "hello world\n")
#+end_src

#+name: for-input
#+begin_src shell
cat <<EOF
(import (srfi 27))
<<for-expansion>>
EOF
#+end_src

#+name: block-in-question
#+begin_src shell :stdin for-input
(eval (read))
#+end_src

This is not very good for two reasons or which the first one is not super importand, but the second is:
1)I am losing syntax highlighting in the for-input block
2)I lose the ability to use the EOF letter combination in the scheme code, which is quite bad, since scheme doesn't have almost any forbidded characters which I could use to demarcate scheme code.

Is there some way to tell babel to _not_ evaluate a block, but rather feed it in as is? Or, maybe, instead, allow <<noweb>> references inside the +begin_example blocks? (I tried substituting begin_quote with begin_example, but they both seem to be not expanding <<noweb>>.

Any recommendations?

Lockywolf
--
Yours sincerely, Vladimir Nikishkin


reply via email to

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