From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joon Ro Subject: Using property values in source code blocks Date: Tue, 5 Jul 2016 23:10:29 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_ccf92218-9b99-45f9-91cd-f1dc2ae59b54_" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKeAV-0008D7-V9 for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 00:10:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKeAR-0005zC-2S for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 00:10:35 -0400 Received: from col004-omc1s18.hotmail.com ([65.55.34.28]:52081) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKeAQ-0005z7-S7 for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 00:10:30 -0400 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: "emacs-orgmode@gnu.org" --_ccf92218-9b99-45f9-91cd-f1dc2ae59b54_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi=2C I'm aware of passing variables through header arguments=2C and also inserti= ng another source code block using the noweb syntax.=20 I was wondering=2C however=2C would it be possible to directly input values= of properties inside source code blocks? For example=2C * Subtree:PROPERTIES::DUMMY: Value:END: #+BEGIN_SRC {{DUMMY}} <- something like this? #+END_SRC Thank you so much=2CJoon = --_ccf92218-9b99-45f9-91cd-f1dc2ae59b54_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi=2C

I'm awa= re of passing variables through header arguments=2C and also inserting anot= her source code block using the noweb syntax. =3B

<= div>I was wondering=2C however=2C would it be possible to directly input va= lues of properties inside source code blocks? For example=2C

=
* Subtree
:PROPERTIES:
:DUMMY: Value
:END:
#+BEGIN_SRC

{{DUMMY}} <= =3B- something like this?

#+END_SRC

Thank you so much=2C
Joon
=
= --_ccf92218-9b99-45f9-91cd-f1dc2ae59b54_-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Using property values in source code blocks Date: Wed, 6 Jul 2016 10:36:55 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKqky-0005Zu-8y for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 13:37:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKqku-0001sR-07 for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 13:37:03 -0400 Received: from iport-bcv1-out.ucsd.edu ([132.239.0.119]:1523) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKqkt-0001sA-NE for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 13:36:59 -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: Joon Ro Cc: "emacs-orgmode@gnu.org" On Tue, 5 Jul 2016, Joon Ro wrote: > Hi, > I'm aware of passing variables through header arguments, and also > inserting another source code block using the noweb syntax. > I was wondering, however, would it be possible to directly input values > of properties inside source code blocks? For example, Yes. `org-property-values' does the trick * Subtree :PROPERTIES: :DUMMY: Value :END: #+BEGIN_SRC shell :var dumdum=(car (org-property-values "DUMMY")) echo $dumdum #+END_SRC #+RESULTS: : Value #+NAME: get-property #+BEGIN_SRC emacs-lisp :var prop="prop" (org-property-values prop) #+END_SRC #+BEGIN_SRC emacs-lisp :noweb yes (quote <> ) #+END_SRC #+RESULTS: | Value | HTH, Chuck From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joon Ro Subject: Re: Using property values in source code blocks Date: Wed, 6 Jul 2016 15:03:34 -0500 Message-ID: References: , Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_89907497-182e-4e56-9c99-fff4138d9902_" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKtMD-0002Oi-U5 for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 16:23:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKtMA-0004Fo-NL for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 16:23:41 -0400 Received: from col004-omc3s14.hotmail.com ([65.55.34.152]:58178) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKtMA-0004FQ-Dt for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 16:23:38 -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" --_89907497-182e-4e56-9c99-fff4138d9902_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > Yes. `org-property-values' does the trick >=20 >=20 > * Subtree > :PROPERTIES: > :DUMMY: Value > :END: >=20 > #+BEGIN_SRC shell :var dumdum=3D(car (org-property-values "DUMMY")) > echo $dumdum > #+END_SRC >=20 > #+RESULTS: > : Value >=20 > #+NAME: get-property > #+BEGIN_SRC emacs-lisp :var prop=3D"prop" > (org-property-values prop) > #+END_SRC >=20 > #+BEGIN_SRC emacs-lisp :noweb yes > (quote > <> > ) > #+END_SRC >=20 > #+RESULTS: > | Value | >=20 > HTH=2C >=20 > Chuck >=20 Thank you so much for the reply - this would be very useful. Would there be= =2C however=2C a way to directly replace some place holder inside a source = code block? The reason is I have to put those values inside a comment=2C so= I cannot pass them as variables. Best=2CJoon = --_89907497-182e-4e56-9c99-fff4138d9902_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

>=3B Ye= s. `org-property-values' does the trick
>=3B
>=3B
>=3B * S= ubtree
>=3B :PROPERTIES:
>=3B :DUMMY: Value
>=3B :END:
&g= t=3B
>=3B #+BEGIN_SRC shell :var dumdum=3D(car (org-property-values "= DUMMY"))
>=3B echo $dumdum
>=3B #+END_SRC
>=3B
>=3B #+= RESULTS:
>=3B : Value
>=3B
>=3B #+NAME: get-property
>= =3B #+BEGIN_SRC emacs-lisp :var prop=3D"prop"
>=3B (org-property-value= s prop)
>=3B #+END_SRC
>=3B
>=3B #+BEGIN_SRC emacs-lisp :no= web yes
>=3B (quote
>=3B <=3B<=3Bget-property(prop=3D"DUMMY")= >=3B>=3B
>=3B )
>=3B #+END_SRC
>=3B
>=3B #+RESULTS= :
>=3B | Value |
>=3B
>=3B HTH=2C
>=3B
>=3B Chuc= k
>=3B

Thank you so much for the reply -= this would be very useful. Would there be=2C however=2C a way to directly = replace some place holder inside a source code block? The reason is I have = to put those values inside a comment=2C so I cannot pass them as variables.=

Best=2C
Joon
= --_89907497-182e-4e56-9c99-fff4138d9902_-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Using property values in source code blocks Date: Wed, 6 Jul 2016 16:05:50 -0700 Message-ID: References: , Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKvtl-0007wC-Cr for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 19:06:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKvtg-0001rn-IL for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 19:06:28 -0400 Received: from iport-acv1-out.ucsd.edu ([132.239.0.176]:32556) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKvtg-0001rj-9B for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 19:06:24 -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: Joon Ro Cc: "emacs-orgmode@gnu.org" On Wed, 6 Jul 2016, Joon Ro wrote: > >> Yes. `org-property-values' does the trick >> >> >> * Subtree >> :PROPERTIES: >> :DUMMY: Value >> :END: >> >> #+BEGIN_SRC shell :var dumdum=(car (org-property-values "DUMMY")) >> echo $dumdum >> #+END_SRC >> [deleted] > > Thank you so much for the reply - this would be very useful. Would there > be, however, a way to directly replace some place holder inside a source > code block? I have no idea what you are asking. > The reason is I have to put those values inside a comment, > so I cannot pass them as variables. So your original query about accessing property values from src blocks was not what you wanted? Examples of what one is trying to do - even if they do not work exactly as intended - are often more helpful than verbal explanations of what one would like to do. Chuck From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joon Ro Subject: Re: Using property values in source code blocks Date: Wed, 6 Jul 2016 22:50:46 -0500 Message-ID: References: , , , , Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_a963075f-6414-42f9-ba7a-183dacc02176_" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bL0L1-0006gV-CX for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 23:50:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bL0Ku-0005nJ-O5 for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 23:50:54 -0400 Received: from col004-omc3s12.hotmail.com ([65.55.34.150]:61782) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bL0Ku-0005nD-Ed for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 23:50:48 -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" --_a963075f-6414-42f9-ba7a-183dacc02176_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =0A= =0A= =0A= > I have no idea what you are asking. >=20 > > The reason is I have to put those values inside a comment=2C=20 > > so I cannot pass them as variables. >=20 > So your original query about accessing property values from src blocks wa= s=20 > not what you wanted? >=20 > Examples of what one is trying to do - even if they do not work exactly a= s=20 > intended - are often more helpful than verbal explanations of what one=20 > would like to do. >=20 > Chuck >=20 I'm sorry if my explanation was not clear=2C but the original example I pro= vided shows exactly what I wanted to do: * Subtree:PROPERTIES::DUMMY: VALUE:END:#+BEGIN_SRC{{DUMMY}} <- something li= ke this?#+END_SRC Basically=2C I want to replace {{DUMMY}} with VALUE=2C without passing it a= s a variable. So just like <> replacement=2C but with a property val= ue instead of a code block. I get the feeling that this is not possible=2C = but I wanted to ask just in case.=20 Best=2CJoon =0A= = --_a963075f-6414-42f9-ba7a-183dacc02176_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
=0A= =0A= =0A=
>=3B I have no idea what you are asking.
>=3B =
>=3B >=3B The reason is I have to put those values inside a comment= =2C
>=3B >=3B so I cannot pass them as variables.
>=3B
>= =3B So your original query about accessing property values from src blocks = was
>=3B not what you wanted?
>=3B
>=3B Examples of what o= ne is trying to do - even if they do not work exactly as
>=3B intende= d - are often more helpful than verbal explanations of what one
>=3B = would like to do.
>=3B
>=3B Chuck
>=3B

<= /div>
I'm sorry if my explanation was not clear=2C but the original example I provided shows exactly what I wan= ted to do:

* Subtree
:PROPERTIES:
:DUMMY: VALUE
:END:

= #+BEGIN_SRC

{{DUMMY}} <=3B- something like this?
<= div style=3D"line-height: 21.3px=3B color: rgb(68=2C 68=2C 68)=3B font-size= : 15px=3B background-color: rgb(255=2C 255=2C 255)=3B">
#+END_SRC

Basically=2C I want to replace =3B{{DUMMY}} with =3BVALUE=2C without passing it as a variable. So just l= ike <=3B<=3Bnoweb>=3B>=3B replacement=2C but with =3Ba property value&nb= sp=3Binst= ead of a code block. =3B
I get the feeling that this is not possible=2C but I wanted to ask j= ust in case. =3B
<= br>
Best=2C=
Joon


=
=0A=
= --_a963075f-6414-42f9-ba7a-183dacc02176_-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Using property values in source code blocks Date: Thu, 7 Jul 2016 08:48:03 -0700 Message-ID: References: , , , , Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLBXE-0002Sk-LQ for emacs-orgmode@gnu.org; Thu, 07 Jul 2016 11:48:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLBXA-0004el-FP for emacs-orgmode@gnu.org; Thu, 07 Jul 2016 11:48:15 -0400 Received: from iport-acv5-out.ucsd.edu ([132.239.0.10]:13509) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLBXA-0004eO-5n for emacs-orgmode@gnu.org; Thu, 07 Jul 2016 11:48:12 -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: Joon Ro Cc: "emacs-orgmode@gnu.org" On Wed, 6 Jul 2016, Joon Ro wrote: > > > >> I have no idea what you are asking. >> [snip] > I'm sorry if my explanation was not clear, but the original example I > provided shows exactly what I wanted to do: And my response showed how to do it: you construct a src block with a noweb reference that places the *results* of evaluating another src block in the code (or comment). The src block in the named in the noweb reference handles retrieving the property value, viz. --8<---------------cut here---------------end--------------->8--- * Subtree :PROPERTIES: :DUMMY: Value :END: #+NAME: get-property #+BEGIN_SRC emacs-lisp :var prop="prop" (car (org-property-values prop)) #+END_SRC #+BEGIN_SRC shell :noweb yes echo <> #+END_SRC #+RESULTS: : Value --8<---------------cut here---------------end--------------->8--- See (info "(org) Noweb reference syntax") Chuck From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joon Ro Subject: Re: Using property values in source code blocks Date: Thu, 7 Jul 2016 10:53:22 -0500 Message-ID: References: , , , , , , , , , Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_875ada4c-36ca-464c-a0ac-abf5898bfe06_" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLBcG-0005aZ-Nl for emacs-orgmode@gnu.org; Thu, 07 Jul 2016 11:53:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLBcC-00060t-Ix for emacs-orgmode@gnu.org; Thu, 07 Jul 2016 11:53:27 -0400 Received: from col004-omc3s7.hotmail.com ([65.55.34.145]:59540) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLBcC-00060e-9o for emacs-orgmode@gnu.org; Thu, 07 Jul 2016 11:53:24 -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" --_875ada4c-36ca-464c-a0ac-abf5898bfe06_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > Date: Thu=2C 7 Jul 2016 08:48:03 -0700 > From: ccberry@ucsd.edu > To: joon.ro@outlook.com > Subject: Re: [O] Using property values in source code blocks > CC: emacs-orgmode@gnu.org >=20 > On Wed=2C 6 Jul 2016=2C Joon Ro wrote: >=20 > > > > > > > >> I have no idea what you are asking. > >> >=20 > [snip] >=20 > > I'm sorry if my explanation was not clear=2C but the original example I= =20 > > provided shows exactly what I wanted to do: >=20 > And my response showed how to do it: you construct a src block with a=20 > noweb reference that places the *results* of evaluating another src block= =20 > in the code (or comment). The src block in the named in the noweb=20 > reference handles retrieving the property value=2C viz. >=20 > --8<---------------cut here---------------end--------------->8--- >=20 > * Subtree > :PROPERTIES: > :DUMMY: Value > :END: >=20 > #+NAME: get-property > #+BEGIN_SRC emacs-lisp :var prop=3D"prop" > (car (org-property-values prop)) > #+END_SRC >=20 > #+BEGIN_SRC shell :noweb yes >=20 > echo <> >=20 > #+END_SRC >=20 > #+RESULTS: > : Value >=20 > --8<---------------cut here---------------end--------------->8--- >=20 >=20 > See >=20 > (info "(org) Noweb reference syntax") >=20 >=20 > Chuck >=20 I see. I must have misunderstood that example. I will try that - thank you = so much! = --_875ada4c-36ca-464c-a0ac-abf5898bfe06_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable


>=3B Date: Thu=2C= 7 Jul 2016 08:48:03 -0700
>=3B From: ccberry@ucsd.edu
>=3B To: j= oon.ro@outlook.com
>=3B Subject: Re: [O] Using property values in sour= ce code blocks
>=3B CC: emacs-orgmode@gnu.org
>=3B
>=3B On = Wed=2C 6 Jul 2016=2C Joon Ro wrote:
>=3B
>=3B >=3B
>=3B &= gt=3B
>=3B >=3B
>=3B >=3B>=3B I have no idea what you are a= sking.
>=3B >=3B>=3B
>=3B
>=3B [snip]
>=3B
>= =3B >=3B I'm sorry if my explanation was not clear=2C but the original ex= ample I
>=3B >=3B provided shows exactly what I wanted to do:
&g= t=3B
>=3B And my response showed how to do it: you construct a src bl= ock with a
>=3B noweb reference that places the *results* of evaluati= ng another src block
>=3B in the code (or comment). The src block in = the named in the noweb
>=3B reference handles retrieving the property= value=2C viz.
>=3B
>=3B --8<=3B---------------cut here-------= --------end--------------->=3B8---
>=3B
>=3B * Subtree
>= =3B :PROPERTIES:
>=3B :DUMMY: Value
>=3B :END:
>=3B
>= =3B #+NAME: get-property
>=3B #+BEGIN_SRC emacs-lisp :var prop=3D"prop= "
>=3B (car (org-property-values prop))
>=3B #+END_SRC
>=3B =
>=3B #+BEGIN_SRC shell :noweb yes
>=3B
>=3B echo <=3B<= =3Bget-property(prop=3D"DUMMY")>=3B>=3B
>=3B
>=3B #+END_SRC<= br>>=3B
>=3B #+RESULTS:
>=3B : Value
>=3B
>=3B --8&= lt=3B---------------cut here---------------end--------------->=3B8---
= >=3B
>=3B
>=3B See
>=3B
>=3B (info "(org) Noweb= reference syntax")
>=3B
>=3B
>=3B Chuck
>=3B

I see. I must have misunderstood that example. I wil= l try that - thank you so much!


=
= --_875ada4c-36ca-464c-a0ac-abf5898bfe06_-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joon Ro Subject: Re: Using property values in source code blocks Date: Fri, 15 Jul 2016 18:44:42 -0500 Message-ID: References: ,,, , , , , , , , , , , , , , , , , Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_f6a22699-b6f9-45b7-b83e-2cfa26d89800_" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOCmm-0004m6-RL for emacs-orgmode@gnu.org; Fri, 15 Jul 2016 19:44:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bOCmh-0007ny-Tt for emacs-orgmode@gnu.org; Fri, 15 Jul 2016 19:44:47 -0400 Received: from col004-omc3s7.hotmail.com ([65.55.34.145]:56231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOCmh-0007ns-K7 for emacs-orgmode@gnu.org; Fri, 15 Jul 2016 19:44:43 -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" --_f6a22699-b6f9-45b7-b83e-2cfa26d89800_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable It seems org-property-values gets the property value for the buffer - it en= ds up getting the property value from the last subtree in the buffer. I sol= ved this by using either (org-entry-get nil prop) or (car (org-entry-get-mu= ltivalued-property nil prop)) instead of (car (org-property-values prop)).= =20 I spoke too early - with (org-entry-get nil prop) I have to put the code bl= ock under the subtree I want to extract the property value from. Would it b= e possible to get the property value of the current subtree? For example=2C= the following * Top Heading#+NAME: get-property#+BEGIN_SRC emacs-lisp :noweb yes :var pro= p=3D"prop"(car (org-entry-get-multivalued-property nil prop))#+END_SRC ** Subheading:PROPERTIES::DUMMY: 100:END: #+BEGIN_SRC shell :noweb yesecho <>#+END_SRC yields nil.=20 Best Regards=2CJoon = --_f6a22699-b6f9-45b7-b83e-2cfa26d89800_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

<= div>
It seems =3Borg-property-values gets the property value for the buffer - it ends up ge= tting the property value from the last subtree in the buffer. =3BI solved this by using either =3B(org-entry-get nil prop) or =3B(car (org-entry-get-multivalued-prop= erty nil prop)) instead of =3B= (car (org-property-values prop)). =3B

I spoke too early - with =3B(org-entry-get nil prop) I have to put the code block under the subtre= e I want to extract the property value from. Would it be possible to get th= e property value of the current subtree? For example=2C the following

* Top Heading
<= div>
#+NAME: get-property
#+BEGIN_SRC emacs-lisp :noweb yes :var prop=3D"prop"
=
(car (org-entry-get-multivalued-property nil prop))
<= /div>
#+END_SRC

** Subheading
:PROPERTIES= :
:= DUMMY:  =3B  =3B100
:END:

=
#+BEGIN_SRC she= ll :noweb yes
echo <=3B<=3Bget-property(prop=3D"DUMMY")&g= t=3B>=3B
#+END_SRC
=

yields nil. =3B

Best Rega= rds=2C
Joon

= --_f6a22699-b6f9-45b7-b83e-2cfa26d89800_-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joon Ro Subject: Re: Using property values in source code blocks Date: Fri, 15 Jul 2016 18:38:36 -0500 Message-ID: References: ,,, , , ,,, , , , , , , , Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_fcdbe08b-8a91-49f6-95b5-a96eca069f8d_" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOCgu-00050x-06 for emacs-orgmode@gnu.org; Fri, 15 Jul 2016 19:38:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bOCgp-0006rG-1U for emacs-orgmode@gnu.org; Fri, 15 Jul 2016 19:38:42 -0400 Received: from col004-omc3s18.hotmail.com ([65.55.34.157]:60895) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOCgo-0006r2-P1 for emacs-orgmode@gnu.org; Fri, 15 Jul 2016 19:38:38 -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" --_fcdbe08b-8a91-49f6-95b5-a96eca069f8d_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > --8<---------------cut here---------------end--------------->8--- >=20 > * Subtree > :PROPERTIES: > :DUMMY: Value > :END: >=20 > #+NAME: get-property > #+BEGIN_SRC emacs-lisp :var prop=3D"prop" > (car (org-property-values prop)) > #+END_SRC >=20 > #+BEGIN_SRC shell :noweb yes >=20 > echo <> >=20 > #+END_SRC >=20 > #+RESULTS: > : Value >=20 > --8<---------------cut here---------------end--------------->8--- >=20 It seems org-property-values gets the property value for the buffer - it en= ds up getting the property value from the last subtree in the buffer. I sol= ved this by using either (org-entry-get nil prop) or (car (org-entry-get-mu= ltivalued-property nil prop)) instead of (car (org-property-values prop)).= =20 Thanks again!-Joon = --_fcdbe08b-8a91-49f6-95b5-a96eca069f8d_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
>= =3B --8<=3B---------------cut here---------------end--------------->=3B= 8---
>=3B
>=3B * Subtree
>=3B :PROPERTIES:
>=3B :DUMMY= : Value
>=3B :END:
>=3B
>=3B #+NAME: get-property
>=3B= #+BEGIN_SRC emacs-lisp :var prop=3D"prop"
>=3B (car (org-property-val= ues prop))
>=3B #+END_SRC
>=3B
>=3B #+BEGIN_SRC shell :nowe= b yes
>=3B
>=3B echo <=3B<=3Bget-property(prop=3D"DUMMY")>= =3B>=3B
>=3B
>=3B #+END_SRC
>=3B
>=3B #+RESULTS:>=3B : Value
>=3B
>=3B --8<=3B---------------cut here------= ---------end--------------->=3B8---
>=3B

It seems=  =3Borg-property-values gets the pro= perty value for the buffer - it ends up getting the property value from the= last subtree in the buffer. =3BI solved this by using either =3B(org-entry-get nil prop) or =3B(car (org-entry-get-multivalued-property nil prop)) instead of&n= bsp=3B(car (org-property-values p= rop)). =3B

Thanks again!
=
-Joon

= --_fcdbe08b-8a91-49f6-95b5-a96eca069f8d_-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Using property values in source code blocks Date: Fri, 15 Jul 2016 19:05:52 -0700 Message-ID: References: , , , , , , , , , , , , , , , , , , , Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOEzR-0000Wv-Ag for emacs-orgmode@gnu.org; Fri, 15 Jul 2016 22:06:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bOEzL-00067a-98 for emacs-orgmode@gnu.org; Fri, 15 Jul 2016 22:06:00 -0400 Received: from iport-acv4-out.ucsd.edu ([132.239.0.7]:45185) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOEzL-00067P-0D for emacs-orgmode@gnu.org; Fri, 15 Jul 2016 22:05:55 -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: Joon Ro Cc: "emacs-orgmode@gnu.org" On Fri, 15 Jul 2016, Joon Ro wrote: > > I spoke too early - with (org-entry-get nil prop) I have to put the code > block under the subtree I want to extract the property value from. Would > it be possible to get the property value of the current subtree? Give org-entry-get a suitable value for `pom'. See the docstring for org-entry-get. Example: --8<---------------cut here---------------start------------->8--- * Top Heading #+NAME: get-property #+BEGIN_SRC emacs-lisp :noweb yes :var prop="prop" :var pom=0 (car (org-entry-get-multivalued-property pom prop)) #+END_SRC ** Subheading :PROPERTIES: :DUMMY: 100 :END: #+BEGIN_SRC shell :noweb yes echo <> #+END_SRC #+RESULTS: : 100 --8<---------------cut here---------------end--------------->8--- Chuck From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joon Ro Subject: Re: Using property values in source code blocks Date: Fri, 15 Jul 2016 21:47:44 -0500 Message-ID: References: , , , , , , , , , , , , , , ,,,,, , , , , , , , , , Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_6e68cb5f-4ea1-4013-8c94-8ec5396a8859_" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOFdv-000094-2j for emacs-orgmode@gnu.org; Fri, 15 Jul 2016 22:47:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bOFdq-0005AR-TA for emacs-orgmode@gnu.org; Fri, 15 Jul 2016 22:47:50 -0400 Received: from col004-omc3s2.hotmail.com ([65.55.34.140]:52833) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOFdq-0005AI-K5 for emacs-orgmode@gnu.org; Fri, 15 Jul 2016 22:47:46 -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" --_6e68cb5f-4ea1-4013-8c94-8ec5396a8859_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable >=20 > Example: >=20 > --8<---------------cut here---------------start------------->8--- >=20 > * Top Heading >=20 > #+NAME: get-property > #+BEGIN_SRC emacs-lisp :noweb yes :var prop=3D"prop" :var pom=3D0 > (car (org-entry-get-multivalued-property pom prop)) > #+END_SRC >=20 > ** Subheading > :PROPERTIES: > :DUMMY: 100 > :END: >=20 > #+BEGIN_SRC shell :noweb yes > echo <> > #+END_SRC >=20 > #+RESULTS: > : 100 >=20 > --8<---------------cut here---------------end--------------->8--- >=20 Hi Chuck=2C Thank you so much. It definitely works when I evaluate the code block - but= my ultimate goal is to tangle the source code (I want to generate bunch of= script files with a template using property values)=2C and when I tangle t= he code block it returns nil. For example: * Top Heading#+NAME: get-property#+BEGIN_SRC emacs-lisp :noweb yes :var pro= p=3D"prop" :var pom=3D0(car (org-entry-get-multivalued-property pom prop))#= +END_SRC** Subheading:PROPERTIES::DUMMY: 100:END:#+BEGIN_SRC shell :noweb y= es :tangle ./tangle-test.shecho <>#+END_SRC When I evaluate the code block=2C I get : 100 results. However=2C when I ta= ngle the block=2C the resulting tangle-test.sh has echo nil instead of echo= 100.=20 Am I doing something wrong? Thank you so much for your help. -Joon = --_6e68cb5f-4ea1-4013-8c94-8ec5396a8859_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable


>=3B
>=3B E= xample:
>=3B
>=3B --8<=3B---------------cut here--------------= -start------------->=3B8---
>=3B
>=3B * Top Heading
>=3B =
>=3B #+NAME: get-property
>=3B #+BEGIN_SRC emacs-lisp :noweb yes= :var prop=3D"prop" :var pom=3D0
>=3B (car (org-entry-get-multivalued-= property pom prop))
>=3B #+END_SRC
>=3B
>=3B ** Subheading<= br>>=3B :PROPERTIES:
>=3B :DUMMY: 100
>=3B :END:
>=3B
= >=3B #+BEGIN_SRC shell :noweb yes
>=3B echo <=3B<=3Bget-property= (prop=3D"DUMMY"=2Cpom=3D(point))>=3B>=3B
>=3B #+END_SRC
>=3B =
>=3B #+RESULTS:
>=3B : 100
>=3B
>=3B --8<=3B-------= --------cut here---------------end--------------->=3B8---
>=3B
<= br>
Hi Chuck=2C

Thank you so much. It de= finitely works when I evaluate the code block - but my ultimate goal is to = tangle the source code (I want to generate bunch of script files with a tem= plate using property values)=2C and when I tangle the code block it returns= nil. For example:

* Top Heading
=
#+NAME: get-property
#+BEGIN_SRC emacs-lisp = :noweb yes :var prop=3D"prop" :var pom=3D0
(car (org-e= ntry-get-multivalued-property pom prop))
#+END_SRC
** Subheading
:PROPERTIES:
:DUMMY: 100
:END:
#+B= EGIN_SRC shell :noweb yes :tangle ./tangle-test.sh
ech= o <=3B<=3Bget-property(prop=3D"DUMMY"=2Cpom=3D(point))>=3B>=3B
#+END_SRC

When= I evaluate the code block=2C I get : 100 results. However=2C when I tangle= the block=2C the resulting tangle-test.sh has =3Becho nil instead of&n= bsp=3Becho 100. =3B

Am I doing something wrong= ? Thank you so much for your help.

-Joon




<= /body> = --_6e68cb5f-4ea1-4013-8c94-8ec5396a8859_-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Using property values in source code blocks Date: Sat, 16 Jul 2016 09:02:35 -0700 Message-ID: References: , , , , , , , , , , , , , , , , , , , , , , , , , , , , Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOS3B-00062S-SJ for emacs-orgmode@gnu.org; Sat, 16 Jul 2016 12:02:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bOS35-0002lW-Rq for emacs-orgmode@gnu.org; Sat, 16 Jul 2016 12:02:44 -0400 Received: from iport-acv2-out.ucsd.edu ([132.239.0.174]:16182) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOS35-0002lN-FL for emacs-orgmode@gnu.org; Sat, 16 Jul 2016 12:02:39 -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: Joon Ro Cc: "emacs-orgmode@gnu.org" On Fri, 15 Jul 2016, Joon Ro wrote: > > >> >> Example: >> >> --8<---------------cut here---------------start------------->8--- >> >> * Top Heading >> >> #+NAME: get-property >> #+BEGIN_SRC emacs-lisp :noweb yes :var prop="prop" :var pom=0 >> (car (org-entry-get-multivalued-property pom prop)) >> #+END_SRC >> >> ** Subheading >> :PROPERTIES: >> :DUMMY: 100 >> :END: >> >> #+BEGIN_SRC shell :noweb yes >> echo <> >> #+END_SRC >> >> #+RESULTS: >> : 100 >> >> --8<---------------cut here---------------end--------------->8--- >> > > Hi Chuck, > Thank you so much. It definitely works when I evaluate the code block - > but my ultimate goal is to tangle the source code (I want to generate > bunch of script files with a template using property values), and when I > tangle the code block it returns nil. I do not see an easy way to do what you want only with tangle. There are hooks you can define that might enable you to set things up. Maybe you can use `org-babel-pre-tangle-hook' to collect the property values and put them somewhere that `org-babel-post-tangle-hook' can get at them and use them to modify the tangled results accordingly. Or maybe `org-babel-post-tangle-hook' can do it by using methods like those in `org-babel-detangle' to look back at the *.org file. Another alternative is to write all of your code blocks so they will execute to create the code you want as results and then tangle those results. You would use :wrap like this: --8<---------------cut here---------------start------------->8--- #+BEGIN_SRC shell :noweb yes :wrap "src shell :tangle ./tangle-test.sh" echo "echo " <> #+END_SRC --8<---------------cut here---------------end--------------->8--- Execute the src block and then tangle the buffer. In fact, if you go that route it might make more sense to write elisp code blocks to find the prpoerty values and then format the results. Chuck 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_--