From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vitalie Spinu Subject: Re: org-export: how to copy the parsed tree? Date: Sat, 01 Mar 2014 13:21:26 -0800 Message-ID: <877g8deht5.fsf@gmail.com> References: <87wqgeemto.fsf@gmail.com> <87vbvyp2v5.fsf@gmail.com> <87ob1pepzh.fsf@gmail.com> <878ustpr7k.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJrLf-0002cD-AC for emacs-orgmode@gnu.org; Sat, 01 Mar 2014 16:21:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WJrLe-0004Mo-9t for emacs-orgmode@gnu.org; Sat, 01 Mar 2014 16:21:31 -0500 Received: from mail-pd0-x22e.google.com ([2607:f8b0:400e:c02::22e]:34760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJrLe-0004Md-2L for emacs-orgmode@gnu.org; Sat, 01 Mar 2014 16:21:30 -0500 Received: by mail-pd0-f174.google.com with SMTP id y13so2147644pdi.5 for ; Sat, 01 Mar 2014 13:21:28 -0800 (PST) In-Reply-To: <878ustpr7k.fsf@gmail.com> (Nicolas Goaziou's message of "Sat, 01 Mar 2014 22:02:55 +0100") 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: Nicolas Goaziou Cc: emacs-orgmode@gnu.org >>> Nicolas Goaziou on Sat, 01 Mar 2014 22:02:55 +0100 wrote: [...] > In this case, I think I would build the tree, since data is duplicated > (e.g. "* H1"), not moved. Is there an idiomatic way to do this? Like constructors of org elements? Or, one just starts with an empty '(headline) list and populate it with org-element-set-contents and org-element-put-property? [...] >> The :parent seems to be stored in 2 places for the headline, in the >> headline itself and in the :title. > You are wrong. Headline's parent is stored only in the :parent property > of the headline. You get it with: > (org-element-property :parent headline) > Within `:title', `:parent' property refers to the parent of the objects > contained in :title, which is the headline itself: > (eq (org-element-property :parent > ;; The first object in the :title property. > (car (org-element-property :title headline))) > headline) => t It makes sense now. Thanks. [...] >> BTW, is there a way to pretty print the org tree? I think that's the >> main barrier for me in understanding how it all works. > Use `pp' and set both `print-level' and `print-circle' accordingly. Thanks. Didn't know about this. Vitalie