From mboxrd@z Thu Jan 1 00:00:00 1970 From: Diego Zamboni Subject: Re: noweb Date: Wed, 22 Jan 2020 23:14:19 +0100 Message-ID: References: <87sgk7qnxb.fsf@nulle1.home> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000035f2ab059cc1d96c" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:34704) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuOGh-0003CL-6M for Emacs-orgmode@gnu.org; Wed, 22 Jan 2020 17:14:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuOGf-0003fT-RC for Emacs-orgmode@gnu.org; Wed, 22 Jan 2020 17:14:35 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:45933) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iuOGf-0003aj-Cs for Emacs-orgmode@gnu.org; Wed, 22 Jan 2020 17:14:33 -0500 Received: by mail-wr1-x434.google.com with SMTP id j42so803683wrj.12 for ; Wed, 22 Jan 2020 14:14:32 -0800 (PST) In-Reply-To: <87sgk7qnxb.fsf@nulle1.home> 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-mx.org@gnu.org Sender: "Emacs-orgmode" To: Nuno Salgado Cc: Org-mode --00000000000035f2ab059cc1d96c Content-Type: text/plain; charset="UTF-8" Hi Nuno, ":noweb eval" means that noweb references are only expanded during evaluation of the code, but not during export. This is why you get the literal <> references in exported output. Here are the possible values of :noweb and what they mean: https://orgmode.org/manual/noweb.html Also note that if all of this is in the same file, both Script1 and Script2 will be tangled to the same file, you may want to specify different filenames as the value of :tangle (see https://orgmode.org/manual/tangle.html#tangle). Hope this helps, --Diego On Wed, Jan 22, 2020 at 8:41 PM Nuno Salgado wrote: > Hi, > > I'm writing an installation script in org-mode. > > I'm doing something like this: > > Vars definition: > #+NAME:DEFVARS > #+BEGIN_SRC shell :tangle yes > v1=1; > v2=2; > #+END_SRC > > Script1: > #+BEGIN_SRC shell :tangle yes :noweb eval > <> > echo $v1; > #+END_SRC > > Script2: > #+BEGIN_SRC shell :tangle yes :noweb eval > <> > echo $v2; > echo $v1; > #+END_SRC > > This works great when I do C-c C-c in each script. > > But when I do org-babel-tangle, the code gets two <>. > > Does it makes sense? Since I set noweb = eval why does it exports > <>? > > Could you please help me turning around this problem without removing > every reference <> > > Thank you very much. > > > Regards, > NS > > --00000000000035f2ab059cc1d96c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Nuno,

<= div>":noweb eval" means that noweb references are only expanded d= uring evaluation of the code, but not during export. This is why you get th= e literal <<DEFVARS>> references in exported output. Here are t= he possible values of :noweb and what they mean:=C2=A0https://orgmode.org/manual/noweb.html

Also note that if all of this is in the same file, bot= h Script1 and Script2 will be tangled to the same file, you may want to spe= cify different filenames as the value of :tangle (see=C2=A0https://orgmode.org/manual/tangle= .html#tangle).

Hope this=C2=A0helps,
--Diego


On Wed, Jan 22, 2020 at 8:41 PM Nu= no Salgado <nuno@salgado.eu> w= rote:
Hi,

I'm writing an installation script in org-mode.

I'm doing something like this:

=C2=A0 Vars definition:
=C2=A0 #+NAME:DEFVARS
=C2=A0 #+BEGIN_SRC shell :tangle yes
=C2=A0 =C2=A0 v1=3D1;
=C2=A0 =C2=A0 v2=3D2;
=C2=A0 #+END_SRC

=C2=A0 Script1:
=C2=A0 #+BEGIN_SRC shell :tangle yes :noweb eval
=C2=A0 =C2=A0 <<DEFVARS>>
=C2=A0 =C2=A0 echo $v1;
=C2=A0 #+END_SRC

=C2=A0 Script2:
=C2=A0 #+BEGIN_SRC shell :tangle yes :noweb eval
=C2=A0 =C2=A0 <<DEFVARS>>
=C2=A0 =C2=A0 echo $v2;
=C2=A0 =C2=A0 echo $v1;
=C2=A0 #+END_SRC

This works great when I do C-c C-c in each script.

But when I do org-babel-tangle, the code gets two <<DEFVARS>>.<= br>
Does it makes sense? Since I set noweb =3D eval why does it exports
<<DEFVARS>>?

Could you please help me turning around this problem without removing every= reference <<DEFVARS>>

Thank you very much.


Regards,
NS

--00000000000035f2ab059cc1d96c--