[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] org-element - canonical way to parse only headline at point?
From: |
Nicolas Goaziou |
Subject: |
Re: [O] org-element - canonical way to parse only headline at point? |
Date: |
Wed, 30 Jul 2014 18:23:20 +0200 |
Hello,
Thorsten Jolitz <address@hidden> 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