Hi List,

while playing around a bit with two quite useful functions from
org-element.el described here

,--------------------------------------------------------------------
| The library ends by furnishing `org-element-at-point' function, and
| a way to give information about document structure around point
| with `org-element-context'.
`--------------------------------------------------------------------

a few questions arose. I used org-outside-org.org from Worg
(http://orgmode.org/worg/org-tutorials/org-outside-org.html) as an
example file, here is an excerpt of its tree-structure:

,----------------------------------
| buffer: org-outside-org.org
|      15:* Introduction
|      46:* Org-mode everywhere
|      50:** File Structuring
|      54:*** Orgstruct 
|      94:*** Outline with Outshine [...]
`----------------------------------

Each of the headlines in this file has a property drawer like this:

   ,-----------------------------
   | :PROPERTIES:
   | :CUSTOM_ID: file-structuring
   | :END:
   `-----------------------------

1. Question wrt Attribute :parent

(i) With point before the property-drawer of headline 

,--------------------
| ** File Structuring
`--------------------

evaluating this 

,-------------------------------------
| (format "%s" (org-element-at-point))
`-------------------------------------

yields

,-----------------------------------------------------------------------
| "(property-drawer (:begin 2381 :end 2438 :hiddenp outline
| :contents-begin 2397 :contents-end 2429 :post-blank 0 :post-affiliated
| 2381 :parent nil))"
`-----------------------------------------------------------------------

(ii) With point before headline

,--------------------
| ** File Structuring
`--------------------

evaluating

,-------------------------------------
| (format "%s" (org-element-at-point))
`-------------------------------------

yields

,---------------------------------------------------------------------
| "(headline (:raw-value File Structuring :begin 2361 :end 11523
| :pre-blank 0 :hiddenp nil :contents-begin 2381 :contents-end 11522
| :level 2 :priority nil :tags nil :todo-keyword nil :todo-type nil
| :post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil
| :quotedp nil :CUSTOM_ID file-structuring :CATEGORY worg :title File
| Structuring))"
`---------------------------------------------------------------------

The use of the :parent attribute is surprising for me. I would have
expected something like ':parent org-mode everywhere' in the second
example, i.e. the title of the 1st level subtree containing the 2nd
level headline at point. 

I'm not sure what I would have expected in the first example. What is
the parent of an element that is contained in a greater element that has
a parent? Is it nil, or is it the parent of its containing greater
element?

-- 
cheers,
Thorsten



Reply via email to