From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Use of attribute :parent in org-element.el Date: Fri, 19 Apr 2013 17:07:22 +0200 Message-ID: <871ua6pnit.fsf@gmail.com> References: <871ua6ejxr.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:48754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTCuQ-0001e0-K4 for emacs-orgmode@gnu.org; Fri, 19 Apr 2013 11:07:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UTCuM-0002XU-0r for emacs-orgmode@gnu.org; Fri, 19 Apr 2013 11:07:30 -0400 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:55369) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTCuL-0002XQ-RT for emacs-orgmode@gnu.org; Fri, 19 Apr 2013 11:07:25 -0400 Received: by mail-wi0-f176.google.com with SMTP id hj19so962757wib.3 for ; Fri, 19 Apr 2013 08:07:25 -0700 (PDT) In-Reply-To: <871ua6ejxr.fsf@gmail.com> (Thorsten Jolitz's message of "Fri, 19 Apr 2013 15:20:16 +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: Thorsten Jolitz Cc: emacs-orgmode@gnu.org Hello, Thorsten Jolitz writes: > 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. `org-element-at-point' and `org-element-context' return information about the close neighbourhood of point, which is the current section. In other words, each element at top level within the section get a nil :parent property. As a special case, when point is at a headline, each function returns the parsed headline, without any :parent property defined (it would be out of the scope of these functions). > 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? If you parse completely the buffer with `org-element-parse-buffer', you will see that genealogy for property drawer goes like this: property-drawer > section > headline > headline > org-data Regards, -- Nicolas Goaziou