emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to make org-babel expand <<noweb>> but _not_ evaluate the code fed into another block?
@ 2020-02-17  8:46 Vladimir Nikishkin
  0 siblings, 0 replies; only message in thread
From: Vladimir Nikishkin @ 2020-02-17  8:46 UTC (permalink / raw)
  To: emacs-orgmode

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

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

[-- Attachment #2: Type: text/html, Size: 2529 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-17  8:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17  8:46 How to make org-babel expand <<noweb>> but _not_ evaluate the code fed into another block? Vladimir Nikishkin

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).