emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Using property values in source code blocks


From: Joon Ro
Subject: Re: [O] Using property values in source code blocks
Date: Fri, 15 Jul 2016 21:47:44 -0500



>
> 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 <<get-property(prop="DUMMY",pom=(point))>>
> #+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. For example:

* 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 :tangle ./tangle-test.sh
echo <<get-property(prop="DUMMY",pom=(point))>>
#+END_SRC

When I evaluate the code block, I get : 100 results. However, when I tangle the block, the resulting tangle-test.sh has echo nil instead of echo 100. 

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

-Joon





reply via email to

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