From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: "Jherek@t-online.de" <Jherek@t-online.de>
Cc: "gnu.org, emacs-orgmode" <emacs-orgmode@gnu.org>
Subject: Re: Babel: Why does noweb work differently depending on 'call depth'?
Date: Sat, 23 Jun 2018 15:46:26 +0200 [thread overview]
Message-ID: <87a7rlvcnh.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <1529759322663.440746.e1992439432bfc672ed4174d1eaa1eec843c3b21@spica.telekom.de> (Jherek@t-online.de's message of "Sat, 23 Jun 2018 15:08:42 +0200 (CEST)")
Hello,
"Jherek@t-online.de" <Jherek@t-online.de> writes:
> Hi list,
>
> have spent hours with trying to de-mystify this issue, but no chance to get it.
> Any hints or doc references are welcome.
>
>
> Given a src block with a simple if clause depending on parameter p1:
>
> #+NAME: decider
> #+BEGIN_SRC emacs-lisp :var p1="tbd" :results output
>
> (cond ((equal p1 "valA")(print "VALUE A"))
> ((equal p1 "valB")(print "B VALUE"))
> (t (print (concat "ERROR: p1=>|" p1 "|< not handled" ))) )
> #+END_SRC
>
>
> Why does the following noweb call result in the t condition (and not in valB as expected)
> although the p1 value seems to be received by the decider block:
>
> #+BEGIN_SRC shell :var x="valB" :noweb yes :results output raw
> echo -n <<decider(p1="$x")>>
> #+END_SRC
>
> == ERROR: p1=>|valB|< not handled
>
>
> while hard coded param value will work (valA chosen to differentiate from x):
>
> #+BEGIN_SRC shell :var x="valB" :noweb yes :results output raw
> echo -n <<decider(p1="valA")>>
> #+END_SRC
>
> #+RESULTS:
> VALUE A
>
> Hard coded "valB" will work as well.
Noweb expansion is done before references in the current source block
are resolved. You are sending p1="$x" instead of p1="valB".
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2018-06-23 13:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-23 13:08 Babel: Why does noweb work differently depending on 'call depth'? Jherek
2018-06-23 13:46 ` Nicolas Goaziou [this message]
2018-06-24 11:33 ` Jherek
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a7rlvcnh.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=Jherek@t-online.de \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.