From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vladimir Nikishkin Subject: How to make org-babel expand <> but _not_ evaluate the code fed into another block? Date: Mon, 17 Feb 2020 16:46:18 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000a515db059ec19739" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:47253) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3c33-0001yC-10 for emacs-orgmode@gnu.org; Mon, 17 Feb 2020 03:46:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3c31-0005Ex-VE for emacs-orgmode@gnu.org; Mon, 17 Feb 2020 03:46:36 -0500 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]:40295) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3c31-0005De-Nk for emacs-orgmode@gnu.org; Mon, 17 Feb 2020 03:46:35 -0500 Received: by mail-ed1-x533.google.com with SMTP id p3so19740698edx.7 for ; Mon, 17 Feb 2020 00:46:35 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --000000000000a515db059ec19739 Content-Type: text/plain; charset="UTF-8" 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)) <> #+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 <> 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 #+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 <> references inside the +begin_example blocks? (I tried substituting begin_quote with begin_example, but they both seem to be not expanding <>. Any recommendations? Lockywolf -- Yours sincerely, Vladimir Nikishkin --000000000000a515db059ec19739 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello, everyone!

What I want= to do is roughly the following:

#+name: for-expan= sion
#+begin_src scheme
(display "hello wo= rld\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 b= efore feeding it into the next block. It is also not possible to make the &= quot;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-expansi= on>>
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 high= lighting in the for-input block
2)I lose the ability to use the E= OF letter combination in the scheme code, which is quite bad, since scheme = doesn't have almost any forbidded characters which I could use to demar= cate 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 recomm= endations?

Lockywolf
--
Y= ours sincerely, Vladimir Nikishkin

--000000000000a515db059ec19739--