From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Babel: Why does noweb work differently depending on 'call depth'? Date: Sat, 23 Jun 2018 15:46:26 +0200 Message-ID: <87a7rlvcnh.fsf@nicolasgoaziou.fr> References: <1529759322663.440746.e1992439432bfc672ed4174d1eaa1eec843c3b21@spica.telekom.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWis5-0001Hx-EQ for emacs-orgmode@gnu.org; Sat, 23 Jun 2018 09:46:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWis2-0002XD-C4 for emacs-orgmode@gnu.org; Sat, 23 Jun 2018 09:46:33 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:41095) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fWis2-0002Wx-5C for emacs-orgmode@gnu.org; Sat, 23 Jun 2018 09:46:30 -0400 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)") 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.org@gnu.org Sender: "Emacs-orgmode" To: "Jherek@t-online.de" Cc: "gnu.org, emacs-orgmode" Hello, "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 <> > #+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 <> > #+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