[Top][All Lists]

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

Re: org-babel guile source block bug in handling multiple values

From: Ihor Radchenko
Subject: Re: org-babel guile source block bug in handling multiple values
Date: Sat, 11 Mar 2023 10:18:10 +0000

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.

>From 26763df7de8f742e76f10f2e7603ed290b97df65 Mon Sep 17 00:00:00 2001
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: 46e6f579-9eca-e1da-06ea-f2478a603c5a@posteo.de">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
+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
+,#+NAME: get-prompt
+,#+BEGIN_SRC emacs-lisp :var prompt="root> " :var command="ls"
+  (concat prompt command)
+,#+RESULTS: get-prompt
+: root> ls
+,#+BEGIN_SRC emacs-lisp :noweb yes
+  <<get-prompt>>
+The previous block is expanded to
+,#+BEGIN_SRC emacs-lisp
+  (concat prompt command)
 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

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>

reply via email to

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