emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Babel: Why does noweb work differently depending on 'call depth'


From: Nicolas Goaziou
Subject: Re: [O] Babel: Why does noweb work differently depending on 'call depth'?
Date: Sat, 23 Jun 2018 15:46:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hello,

"address@hidden" <address@hidden> 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



reply via email to

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