* [org-babel] How to refer to a specific property when it is defined multiple times?
@ 2010-03-26 15:54 Julien Fantin
2010-03-26 16:33 ` Dan Davison
2010-03-26 16:34 ` Eric Schulte
0 siblings, 2 replies; 3+ messages in thread
From: Julien Fantin @ 2010-03-26 15:54 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 688 bytes --]
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 ?
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
[-- Attachment #1.2: Type: text/html, Size: 1066 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [org-babel] How to refer to a specific property when it is defined multiple times?
2010-03-26 15:54 [org-babel] How to refer to a specific property when it is defined multiple times? Julien Fantin
@ 2010-03-26 16:33 ` Dan Davison
2010-03-26 16:34 ` Eric Schulte
1 sibling, 0 replies; 3+ messages in thread
From: Dan Davison @ 2010-03-26 16:33 UTC (permalink / raw)
To: Julien Fantin; +Cc: emacs-orgmode
Julien Fantin <julien.fantin@gmail.com> 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.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [org-babel] How to refer to a specific property when it is defined multiple times?
2010-03-26 15:54 [org-babel] How to refer to a specific property when it is defined multiple times? Julien Fantin
2010-03-26 16:33 ` Dan Davison
@ 2010-03-26 16:34 ` Eric Schulte
1 sibling, 0 replies; 3+ messages in thread
From: Eric Schulte @ 2010-03-26 16:34 UTC (permalink / raw)
To: Julien Fantin; +Cc: emacs-orgmode
Hi Julien,
Is the following alternative sufficient?
* 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=(car (org-property-values "BUSY_PROPERTY"))
test
#+end_src
#+results:
: BBB
#+begin_src emacs-lisp :var test=(cadr (org-property-values "BUSY_PROPERTY"))
test
#+end_src
#+results:
: AAA
Julien Fantin <julien.fantin@gmail.com> 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 ?
> 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.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-03-26 16:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-26 15:54 [org-babel] How to refer to a specific property when it is defined multiple times? Julien Fantin
2010-03-26 16:33 ` Dan Davison
2010-03-26 16:34 ` Eric Schulte
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).