From: Ihor Radchenko <yantar92@posteo.net>
To: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
Cc: Bruno Barbier <brubar.cs@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: org-babel guile source block bug in handling multiple values
Date: Sat, 11 Mar 2023 10:18:10 +0000 [thread overview]
Message-ID: <875yb7y4kd.fsf@localhost> (raw)
In-Reply-To: <46e6f579-9eca-e1da-06ea-f2478a603c5a@posteo.de>
[-- Attachment #1: Type: text/plain, Size: 600 bytes --]
Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes:
>> This is expected. Noweb includes the src block code without altering it.
>> See 16.11 Noweb Reference Syntax
>>
>> We may probably clarify this in the manual. Would it be helpful?
> I think it would be helpful. I merely tried Python, because it was at hand and
> because I did not find ob-racket in M-x package-list RET and did not have
> another Scheme installed. Cannot say, whether others find the behavior confusing
> or not, but I imagine I would find it helpful, if it was mentioned in the docs.
See the attached tentative patch.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-manual.org-Explain-that-noweb-expansion-does-not.patch --]
[-- Type: text/x-patch, Size: 1800 bytes --]
From 26763df7de8f742e76f10f2e7603ed290b97df65 Mon Sep 17 00:00:00 2001
Message-Id: <26763df7de8f742e76f10f2e7603ed290b97df65.1678529850.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Sat, 11 Mar 2023 11:16:23 +0100
Subject: [PATCH] org-manual.org: Explain that noweb expansion does not carry
over :var
* doc/org-manual.org (Noweb Reference Syntax): Provide an example
explaining that :var header arguments are not in effect when expanding
noweb reference.
Reported-by: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
Link: https://orgmode.org/list/46e6f579-9eca-e1da-06ea-f2478a603c5a@posteo.de
---
doc/org-manual.org | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 1c97d6aa8..2c3ec46a4 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -19117,6 +19117,32 @@ ** Noweb Reference Syntax
,#+END_SRC
#+end_example
+Note that noweb expansion does not automatically carry over =var=
+header arguments. In the following example, attempting to evaluate
+the second code block will give an error, because the variables
+defined in the first code block will not be defined in the second
+block.
+
+#+begin_example
+,#+NAME: get-prompt
+,#+BEGIN_SRC emacs-lisp :var prompt="root> " :var command="ls"
+ (concat prompt command)
+,#+END_SRC
+
+,#+RESULTS: get-prompt
+: root> ls
+
+,#+BEGIN_SRC emacs-lisp :noweb yes
+ <<get-prompt>>
+,#+END_SRC
+
+The previous block is expanded to
+
+,#+BEGIN_SRC emacs-lisp
+ (concat prompt command)
+,#+END_SRC
+#+end_example
+
You may also include the contents of multiple blocks sharing a common
=noweb-ref= header argument, which can be set at the file, subtree,
or code block level. In the example Org file shown next, the body of
--
2.39.1
[-- Attachment #3: Type: text/plain, Size: 224 bytes --]
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
next prev parent reply other threads:[~2023-03-11 10:17 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 11:27 org-babel guile source block bug in handling multiple values Zelphir Kaltstahl
2023-03-07 14:36 ` Ihor Radchenko
2023-03-07 15:18 ` Zelphir Kaltstahl
2023-03-07 19:52 ` Bruno Barbier
2023-03-08 0:55 ` Zelphir Kaltstahl
2023-03-08 19:38 ` Bruno Barbier
2023-03-09 0:44 ` Zelphir Kaltstahl
2023-03-09 13:04 ` [BUG] Inconsistent global/local :var assignments in ob-* for lisps and non-lisps (was: org-babel guile source block bug in handling multiple values) Ihor Radchenko
2023-03-10 10:39 ` Zelphir Kaltstahl
2023-03-11 9:58 ` Ihor Radchenko
2023-03-11 18:30 ` Zelphir Kaltstahl
2023-03-12 11:33 ` Ihor Radchenko
2023-03-19 13:50 ` [PATCH] lisp/ob-scheme.el Zelphir Kaltstahl
2023-03-22 10:43 ` Ihor Radchenko
2023-03-25 14:34 ` Zelphir Kaltstahl
2023-03-26 9:32 ` Ihor Radchenko
2023-04-25 12:28 ` Ihor Radchenko
2023-04-29 11:08 ` Zelphir Kaltstahl
2023-03-09 13:10 ` org-babel guile source block bug in handling multiple values Ihor Radchenko
2023-03-10 10:42 ` Zelphir Kaltstahl
2023-03-11 10:18 ` Ihor Radchenko [this message]
2023-06-02 13:11 ` Ihor Radchenko
2023-03-09 13:11 ` Ihor Radchenko
2023-03-09 14:21 ` Daniel Kraus
2023-03-10 11:57 ` Ihor Radchenko
2023-03-10 10:45 ` Zelphir Kaltstahl
2023-03-08 1:13 ` Zelphir Kaltstahl
2023-03-08 8:55 ` Ihor Radchenko
2023-03-07 15:44 ` Max Nikulin
2023-03-07 21:41 ` Rudolf Adamkovič
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=875yb7y4kd.fsf@localhost \
--to=yantar92@posteo.net \
--cc=brubar.cs@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=zelphirkaltstahl@posteo.de \
/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).