From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joon Ro Subject: Re: Using property values in source code blocks Date: Sat, 16 Jul 2016 12:00:29 -0500 Message-ID: References: , , , , , , , , , , , , , , , , , , , , , , , , , ,,,,, , , , , , , , , , Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_dc5a1ebf-86c2-479a-a40e-cbae52490b8e_" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOSxA-0007F2-Gz for emacs-orgmode@gnu.org; Sat, 16 Jul 2016 13:00:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bOSx6-00042w-6h for emacs-orgmode@gnu.org; Sat, 16 Jul 2016 13:00:36 -0400 Received: from col004-omc3s12.hotmail.com ([65.55.34.150]:55629) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOSx5-00042l-Hr for emacs-orgmode@gnu.org; Sat, 16 Jul 2016 13:00:32 -0400 In-Reply-To: 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: "Charles C. Berry" Cc: "emacs-orgmode@gnu.org" --_dc5a1ebf-86c2-479a-a40e-cbae52490b8e_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > I do not see an easy way to do what you want only with tangle. >=20 > There are hooks you can define that might enable you to set things up.=20 > Maybe you can use `org-babel-pre-tangle-hook' to collect the property=20 > values and put them somewhere that `org-babel-post-tangle-hook' can get a= t=20 > them and use them to modify the tangled results accordingly. Or maybe=20 > `org-babel-post-tangle-hook' can do it by using methods like those in=20 > `org-babel-detangle' to look back at the *.org file. >=20 > Another alternative is to write all of your code blocks so they will=20 > execute to create the code you want as results and then tangle those=20 > results. You would use :wrap like this: >=20 > --8<---------------cut here---------------start------------->8--- >=20 > #+BEGIN_SRC shell :noweb yes :wrap "src shell :tangle ./tangle-test.sh" > echo "echo " <> > #+END_SRC >=20 > --8<---------------cut here---------------end--------------->8--- >=20 > Execute the src block and then tangle the buffer. >=20 > In fact=2C if you go that route it might make more sense to write elisp=20 > code blocks to find the prpoerty values and then format the results. >=20 I see - thank you so much for your help. It does look like I have to write = some code to do this. Since I'm not that familiar with elisp=2C I think I will write a Python cod= e block which has the template as a multi-line string=2C and then just pass= values as arguments to the source code block to generate the shell scripts= . Best=2CJoon = --_dc5a1ebf-86c2-479a-a40e-cbae52490b8e_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
>=3B I do not see an easy= way to do what you want only with tangle.
>=3B
>=3B There are h= ooks you can define that might enable you to set things up.
>=3B Mayb= e you can use `org-babel-pre-tangle-hook' to collect the property
>= =3B values and put them somewhere that `org-babel-post-tangle-hook' can get= at
>=3B them and use them to modify the tangled results accordingly.= Or maybe
>=3B `org-babel-post-tangle-hook' can do it by using method= s like those in
>=3B `org-babel-detangle' to look back at the *.org f= ile.
>=3B
>=3B Another alternative is to write all of your code = blocks so they will
>=3B execute to create the code you want as resul= ts and then tangle those
>=3B results. You would use :wrap like this:=
>=3B
>=3B --8<=3B---------------cut here---------------start-= ------------>=3B8---
>=3B
>=3B #+BEGIN_SRC shell :noweb yes :w= rap "src shell :tangle ./tangle-test.sh"
>=3B echo "echo " <=3B<= =3Bget-property(prop=3D"DUMMY"=2Cpom=3D(point))>=3B>=3B
>=3B #+END= _SRC
>=3B
>=3B --8<=3B---------------cut here---------------en= d--------------->=3B8---
>=3B
>=3B Execute the src block and t= hen tangle the buffer.
>=3B
>=3B In fact=2C if you go that route= it might make more sense to write elisp
>=3B code blocks to find the= prpoerty values and then format the results.
>=3B

= I see - thank you so much for your help. It does look like I have to write = some code to do this.

Since I'm not that familia= r with elisp=2C I think I will write a Python code block which has the temp= late as a multi-line string=2C and then just pass values as arguments to th= e source code block to generate the shell scripts.

Best=2C
Joon


=
= --_dc5a1ebf-86c2-479a-a40e-cbae52490b8e_--