From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Use of attribute :parent in org-element.el Date: Fri, 19 Apr 2013 15:20:16 +0200 Message-ID: <871ua6ejxr.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTBEp-0008Gz-23 for emacs-orgmode@gnu.org; Fri, 19 Apr 2013 09:20:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UTBEn-0006D8-Ab for emacs-orgmode@gnu.org; Fri, 19 Apr 2013 09:20:27 -0400 Received: from plane.gmane.org ([80.91.229.3]:50525) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTBEn-0006Cs-0q for emacs-orgmode@gnu.org; Fri, 19 Apr 2013 09:20:25 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UTBEm-0005we-AO for emacs-orgmode@gnu.org; Fri, 19 Apr 2013 15:20:24 +0200 Received: from g231107063.adsl.alicedsl.de ([92.231.107.63]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 19 Apr 2013 15:20:24 +0200 Received: from tjolitz by g231107063.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 19 Apr 2013 15:20:24 +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: emacs-orgmode@gnu.org 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