From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: org-element - canonical way to parse only headline at point? Date: Wed, 30 Jul 2014 18:23:20 +0200 Message-ID: <87iomestmv.fsf@nicolasgoaziou.fr> References: <87tx60oyrz.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCWeT-0000vv-BL for emacs-orgmode@gnu.org; Wed, 30 Jul 2014 12:23:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCWeI-00014i-Qj for emacs-orgmode@gnu.org; Wed, 30 Jul 2014 12:22:53 -0400 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]:49850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCWeI-00014F-KF for emacs-orgmode@gnu.org; Wed, 30 Jul 2014 12:22:42 -0400 In-Reply-To: <87tx60oyrz.fsf@gmail.com> (Thorsten Jolitz's message of "Tue, 29 Jul 2014 19:33:36 +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: Thorsten Jolitz Cc: emacs-orgmode@gnu.org Hello, Thorsten Jolitz writes: > 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 What about (org-element-at-point) ? Regards, -- Nicolas Goaziou