From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eike Subject: accessing properties in org-element-parse-buffer tree Date: Sat, 30 Aug 2014 20:03:13 +0200 Message-ID: <87ppfhzweg.fsf@ithaka.home> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNn2M-0001TE-SF for emacs-orgmode@gnu.org; Sat, 30 Aug 2014 14:06:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNn2F-0003xE-0j for emacs-orgmode@gnu.org; Sat, 30 Aug 2014 14:06:06 -0400 Received: from ns.km31707.keymachine.de ([87.118.120.70]:41487 helo=eknet.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNn2E-0003we-QM for emacs-orgmode@gnu.org; Sat, 30 Aug 2014 14:05:58 -0400 Received: from 84-73-222-131.dclient.hispeed.ch (EHLO ithaka.home.eknet.org) ([84.73.222.131]) by km31707 (JAMES SMTP Server ) with ESMTPA ID 353040713 for ; Sat, 30 Aug 2014 20:05:57 +0200 (CEST) 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org 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