From: Vladimir Nikishkin <lockywolf@gmail.com>
To: emacs-orgmode@gnu.org
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 [thread overview]
Message-ID: <CA+A2iZYEGMZOiwbe6Vo2RqnNxLZ8cVrs+Jw2ZfJEPz1gQ0ak2w@mail.gmail.com> (raw)
[-- 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 --]
reply other threads:[~2020-02-17 8:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=CA+A2iZYEGMZOiwbe6Vo2RqnNxLZ8cVrs+Jw2ZfJEPz1gQ0ak2w@mail.gmail.com \
--to=lockywolf@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).