From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: org-element - canonical way to parse only headline at point? Date: Tue, 29 Jul 2014 19:33:36 +0200 Message-ID: <87tx60oyrz.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCBHj-0003Ww-RI for emacs-orgmode@gnu.org; Tue, 29 Jul 2014 13:34:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCBHa-00079R-MD for emacs-orgmode@gnu.org; Tue, 29 Jul 2014 13:33:59 -0400 Received: from plane.gmane.org ([80.91.229.3]:47032) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCBHa-00078T-GM for emacs-orgmode@gnu.org; Tue, 29 Jul 2014 13:33:50 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XCBHY-0006YU-Gw for emacs-orgmode@gnu.org; Tue, 29 Jul 2014 19:33:48 +0200 Received: from e178189064.adsl.alicedsl.de ([85.178.189.64]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 29 Jul 2014 19:33:48 +0200 Received: from tjolitz by e178189064.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 29 Jul 2014 19:33:48 +0200 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: emacs-orgmode@gnu.org Hi List, with the new parser, how do I parse only the headline at point? There are ARGS in the parser/mapper functions that restrict parsing, but I suspect that still the whole buffer is parsed for the genealogy - right? With my current knowledge I would either narrow the buffer to the subtree at point or copy this subtree to a temp-buffer before parsing/mapping it, but maybe there is a better way? Would this be a valid template (a simple and fast solution)? #+begin_src emacs-lisp (save-restriction (org-narrow-to-subtree (org-element-map (org-element-parse-buffer 'headline t) 'headline (lambda () ...) nil t t))) #+end_src -- cheers, Thorsten