emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* accessing properties in org-element-parse-buffer tree
@ 2014-08-30 18:03 Eike
  2014-08-30 19:07 ` Eike
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Eike @ 2014-08-30 18:03 UTC (permalink / raw)
  To: org-mode


Hello list,

I want to ask for help regarding elisp and org-elements. I like to
access the properties of all my headlines and I created the following
function (tree is the parsed tree) that collects them into an a-list:

#+begin_src emacs-lisp
  (defun collect-props (tree)
    (car (org-element-map tree 'headline
           (lambda (hl)
             (when (eq 2 (org-element-property :level hl)) ; want only level-2 properties
               (org-element-map hl 'node-property
                 (lambda (np)
                   (cons (org-element-property :key np)
                         (org-element-property :value np)))))))))
#+end_src

I'm not very confident about this, is this ok? Is there a better way?
For example, the first car looks strange, and I don't know how to get
rid of it.

Thanks you very much in advance!!!
Kind regards
Eike

--
gpg: AD7AC35E
finger print: 137F BB0B 1639 D25F DC5D  E59C B412 C5F5 AD7A C35E

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-08-31  9:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-30 18:03 accessing properties in org-element-parse-buffer tree Eike
2014-08-30 19:07 ` Eike
2014-08-30 19:41 ` Thorsten Jolitz
2014-08-30 20:20   ` Eike
2014-08-30 22:10     ` Thorsten Jolitz
2014-08-31  2:08 ` Eric Abrahamsen
2014-08-31  9:12   ` Eike

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).