From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daimrod Subject: Re: Circular lists/shared structures in org-element parse-tree Date: Fri, 28 Jun 2013 22:43:34 +0200 Message-ID: <877ghex8y1.fsf@tanger.home> References: <87a9ma9fra.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsfS1-00043O-6d for emacs-orgmode@gnu.org; Fri, 28 Jun 2013 16:39:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsfS0-0005zO-4C for emacs-orgmode@gnu.org; Fri, 28 Jun 2013 16:39:25 -0400 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:62405) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsfRz-0005z9-UI for emacs-orgmode@gnu.org; Fri, 28 Jun 2013 16:39:24 -0400 Received: by mail-wi0-f169.google.com with SMTP id c10so2185954wiw.4 for ; Fri, 28 Jun 2013 13:39:22 -0700 (PDT) In-Reply-To: <87a9ma9fra.fsf@gmail.com> (Thorsten Jolitz's message of "Fri, 28 Jun 2013 21:50:17 +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 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Thorsten Jolitz writes: > Hi List,=20 > > I wonder how I can find out in a (elisp) program the points in the parse > tree (returned by org-element-parse-buffer) where shared structures are > used.=20 > > In the read-syntax, its easy to see (especially with `print-circle' set > to non-nil): > > #+begin_src emacs-lisp > #2=3D(org-data nil #1=3D(headline (:raw-value "header 1" > [...] :parent #2#) [...]=20=20 > #+end_src > > but when processing the parse tree as a list in elisp, how can I detect t= he > fact that=20 > > ,------------ > | :parent #2# > `------------ > > refers to=20 > > ,----------------- > | #2=3D(org-data nil > `----------------- > > i.e. points back to an already existing structure? AFAIK you have to track all pointers inspected to see if one has already be seen. For example, I've implemented a version of equal[1] to compare this kind of lists (to add tests to org-sync). [1] https://github.com/daimrod/Emacs-config/blob/master/elisp/dmd-utils.el#= L25 =2D-=20 Daimrod/Greg --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iQIcBAEBAgAGBQJRzfV7AAoJEBNzVHcrZRiUoA8P/2lJ0KCePNF8h2tfXJc9/B7i 9KUUnHavS72LGwdTVqRMRpUlgg48wAInWQ675ne0vsBOJ7TVatrx5cxlrvMfgJbc RIxjtmetdtV248I3NXFzXEbSv99rbxIqxz7h+yM8CsKFV/CL7+gSUOw10FyY2dKw /7gZYvY/Zb0htM/DWyRfSt35iaQlcyfMaZCmlbL/pMID9K2L8PN9OY1nI2k4eFh/ xY3WO0+3xVvxOBlx7wBDJKoxuaJKVsop9+2OIkNsoPivAL0uB3Ek28lAclxwHCgZ 9SrFBH19rNGcR8oKVk1U7HjergTuicNJ6xJMk2l2RX5c6/SAScg2pmHWUVRFl1Aw KHQl2dFsPJkoFe7gihjdKijgOwHj3FZyjlvdLEmn6fm3V+nEZTnhvZONLmGG/k5E 7mkVJaSEoaqf6rbaDadMc0ZneMelYK/LVNjq/Vj3vz0WnCWU2pp6bGGrMpSNcIE/ US7VkxLl5ubTUCHNVHERM2drbOcyqYDUcuqSwAFg9DHTL4LzP6T2BXAdb8i9YQpX lMnQZclqw6zlXAnRdWcfm1JDhyyDHL266px4T7UpJgTWDaK68BVqsJANlkri4BJo ALCyJLJ/3pMbWSn3wh7UsNixH7lRHW8/j62KBddrkHveBZgV3eGRsQwDn7OjJ6xh KWl6tzzpEOPUd73F9x8E =lLWi -----END PGP SIGNATURE----- --=-=-=--