Hello Rasmus,
Thank you for the fast reply, the link you've given on interpreting is very useful ! Also didn't know there existed such thing as the org-dp library to manipulate org-elements, I'll sure check it out.
More about question number 3:
>> 3) How can the output of (org-element-parse-secondary-string ...) be used.
>> When I give a heading and bit of text as input (output of
>> buffer-substring), it looks like it returns the 'content' of the region.
>> Though I can't seem to use it anyway as 'CONTENT' for the functions
>> requiring this.
The reason I've tried this (and the internal org-element--parse-elements) is because I'd prefer not having to parse the whole buffer and still get the contents. The local parsing functions (org-element-at-point) and (org-element-context) don't contain content (stated in the org-element api, also tried it ).
Now I'm not sure IF I really NEED it? I could actually get the contents using the :content-begin and :content-end and other properties from (org-elemen-at-point) BUT I don't know the exact syntax the content should have and how to merge it with the element-list I get from (org-element-at-point) before feeding it to the org-element-interpret-data.
I don't actually know how 'content' looks like... When applying a small function
" (defun test ()
(interactive)
(debug)
(setq content (org-element-contents (org-element-parse-buffer))))"
on a simple headline with some text,
" * woot
And a bit of text "
I can see in debugger (returned values) that 'content' is actually (org-data nil ('content'). See output below. Thus concluding that content is also just an <element>. Then why do all the org-element-<element>-interpreters require both the <element> AND 'content', since to me, it seems logical that all this information is already inside <element>.
At first I thought that the things behind # were 'content' (for example in the output below. These don't show up in (org-element-at-point), thus explaining why they returned nil when asked for content. The org-element-parse-secondary-string also returns all things behind #. If this is NOT content, then how to manipulate this data (behind the #) whilst assuring that syntax and position remains valid for org-element-interpret-data to understand?
OUTPUT:
(org-data nil (headline (:raw-value "woot" :begin 1 :end 29 :pre-blank 0 :contents-begin 8 ...) (section (:begin 8 :end 29 :contents-begin
8 :contents-end 26 :post-blank 2 ...) (paragraph (:begin 8 :end 26 :contents-begin 8 :contents-end 26 :post-blank 0 ...) #("And a bit of
text " 0 18 (:parent #3))))))
((headline (:raw-value "woot" :begin 1 :end 29 :pre-blank 0 :contents-begin 8 ...) (section (:begin 8 :end 29 :contents-begin 8
:contents-end 26 :post-blank 2 ...) (paragraph (:begin 8 :end 26 :contents-begin 8 :contents-end 26 :post-blank 0 ...) #("And a bit of text
" 0 18 (:parent #3))))))
Perhaps my view is completely wrong, so please correct me if possible.
Thanks for the time,
Dieter