* Circular lists/shared structures in org-element parse-tree
@ 2013-06-28 19:50 Thorsten Jolitz
2013-06-28 20:43 ` Daimrod
0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Jolitz @ 2013-06-28 19:50 UTC (permalink / raw)
To: emacs-orgmode
Hi List,
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.
In the read-syntax, its easy to see (especially with `print-circle' set
to non-nil):
#+begin_src emacs-lisp
#2=(org-data nil #1=(headline (:raw-value "header 1"
[...] :parent #2#) [...]
#+end_src
but when processing the parse tree as a list in elisp, how can I detect the
fact that
,------------
| :parent #2#
`------------
refers to
,-----------------
| #2=(org-data nil
`-----------------
i.e. points back to an already existing structure?
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Circular lists/shared structures in org-element parse-tree
2013-06-28 19:50 Circular lists/shared structures in org-element parse-tree Thorsten Jolitz
@ 2013-06-28 20:43 ` Daimrod
2013-06-28 21:59 ` Thorsten Jolitz
0 siblings, 1 reply; 3+ messages in thread
From: Daimrod @ 2013-06-28 20:43 UTC (permalink / raw)
To: Thorsten Jolitz; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]
Thorsten Jolitz <tjolitz@gmail.com> writes:
> Hi List,
>
> 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.
>
> In the read-syntax, its easy to see (especially with `print-circle' set
> to non-nil):
>
> #+begin_src emacs-lisp
> #2=(org-data nil #1=(headline (:raw-value "header 1"
> [...] :parent #2#) [...]
> #+end_src
>
> but when processing the parse tree as a list in elisp, how can I detect the
> fact that
>
> ,------------
> | :parent #2#
> `------------
>
> refers to
>
> ,-----------------
> | #2=(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
--
Daimrod/Greg
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Circular lists/shared structures in org-element parse-tree
2013-06-28 20:43 ` Daimrod
@ 2013-06-28 21:59 ` Thorsten Jolitz
0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Jolitz @ 2013-06-28 21:59 UTC (permalink / raw)
To: emacs-orgmode
Daimrod <daimrod@gmail.com> writes:
> Thorsten Jolitz <tjolitz@gmail.com> writes:
[...]
>> but when processing the parse tree as a list in elisp, how can I
>> detect the fact that
>>
>> ,------------
>> | :parent #2#
>> `------------
>>
>> refers to
>>
>> ,-----------------
>> | #2=(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
Oh my ... I knew this would complicate my life a bit ...
Thanks for the link, this example function is indeed very helpful.
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-28 21:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-28 19:50 Circular lists/shared structures in org-element parse-tree Thorsten Jolitz
2013-06-28 20:43 ` Daimrod
2013-06-28 21:59 ` Thorsten Jolitz
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).