emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] [org-babel] How to refer to a specific property when it is


From: Dan Davison
Subject: Re: [Orgmode] [org-babel] How to refer to a specific property when it is defined multiple times?
Date: Fri, 26 Mar 2010 12:33:13 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Julien Fantin <address@hidden> writes:

> Consider the following :
>  
> * heading A
> :PROPERTIES:
> :BUSY_PROPERTY: AAA
> :END:
> * heading B
> :PROPERTIES:
> :BUSY_PROPERTY: BBB
> :END:
>
> #+begin_src emacs-lisp  :var test=(org-entry-get nil "BUSY_PROPERTY" t)
> test
> #+end_src
> #+results:
> : BBB
>
> #+begin_src emacs-lisp  :var test=(org-property-values "BUSY_PROPERTY")
> test
> #+end_src
> #+results:
> | BBB | AAA |
>
>
> Is there a way I can refer to my BUSY_PROPERTY, in the context of particular
> heading ?

Hi Julien,

You've probably thought of these, but the ways I can think of are


An org-babel method: 
--------------------

1. place a "reporter" elisp block in the heading, e.g.

* heading A
:PROPERTIES:
:BUSY_PROPERTY: AAA
:END:

#+source: reporter-A
#+begin_src emacs-lisp :var prop=""
(org-entry-get nil prop t)
#+end_src

* heading B
:PROPERTIES:
:BUSY_PROPERTY: BBB
:END:

#+begin_src emacs-lisp :var test=reporter-A(prop="BUSY_PROPERTY")
test
#+end_src

#+results:
: AAA

Elisp methods:
--------------

I think identifying headings with CUSTOM_IDs, and usinng the org
function org-id-find could help here:

1. Expand the elisp code in the :var reference so that it moves to the
   desired heading before calling org-entry-get, under the protection of
   a save-excursion.

2. Put the elisp code in (1) into an elisp block
   "get-property-at-heading", and use something like 
   :var test=get-property-at-heading(heading-id=id, prop="BUSY_PROPERTY")

Dan


> Has shown above, I can not get a reference to the heading it was defined in.
> Is there a way to deal with those namespacing conerns right now ?
>
> Note : This emacs-lisp evaluation in src headers has only been recently
> implemented by Eric schulte.
>
> cheers
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode




reply via email to

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