Re: [O] org-element - canonical way to parse only headline at point?

2014-07-30 Thread Nicolas Goaziou
Hello,

Thorsten Jolitz tjol...@gmail.com 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



Re: [O] org-element - canonical way to parse only headline at point?

2014-07-30 Thread Thorsten Jolitz
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Hello,

 Thorsten Jolitz tjol...@gmail.com 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) ?

Thats why I asked - exactly the function I was looking for. Thanks.

-- 
cheers,
Thorsten