Hello,

Brett Viren <b...@bnl.gov> writes:

> Eric Schulte <schulte.e...@gmail.com> writes:
>
>> You can use `org-element-parse-buffer' to convert an Emacs Buffer to a
>> structured Emacs Lisp object.  At that point you can use existing tools
>> for converting lisp to JSON or YAML.  I've used cl-json for Common Lisp,
>> I would imagine something similar exists for Emacs Lisp.
>
> Thanks for the suggestion.  I pursued that a bit this weekend.  The
> resulting data structure is a Circular Object[1] due to the ":parent"
> references.  It seems dealing with this kind of data structure is
> somewhat uncommon (or my search-fu lacking), although I do find a recent
> reference to it on this mailing list[2].  I also found a "cust-print"[3]
> feature from Emacs 19 which has since been removed.  It shows a way to
> deal with Circular Objects.  So far it has strongly taxed my poor elisp
> skills but I plan to pursue this direction a bit more.
>
> I did try throwing a JSON parser/generator[4] at the output of
> org-element-parse-buffer but this failed due to exceeding emacs's
> recursion limits.  I think this must be from the ":parent" references
> getting recursed on forever.

You can walk the tree, e.g. with `org-element-map', and remove
all :parent references if you don't need them.


Regards,

-- 
Nicolas Goaziou

Reply via email to