From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Org mode and "shunt" exporters? Date: Mon, 09 Dec 2013 20:55:17 +0100 Message-ID: <87k3fdu7dm.fsf@gmail.com> References: <87zjoe7mf2.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq6vH-0005x7-Lk for emacs-orgmode@gnu.org; Mon, 09 Dec 2013 14:55:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vq6vB-0003I1-TQ for emacs-orgmode@gnu.org; Mon, 09 Dec 2013 14:55:19 -0500 Received: from mail-we0-x232.google.com ([2a00:1450:400c:c03::232]:54779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq6vB-0003Hn-NB for emacs-orgmode@gnu.org; Mon, 09 Dec 2013 14:55:13 -0500 Received: by mail-we0-f178.google.com with SMTP id u57so4033495wes.9 for ; Mon, 09 Dec 2013 11:55:11 -0800 (PST) In-Reply-To: (Brett Viren's message of "Mon, 09 Dec 2013 12:38:43 -0500") 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: Brett Viren Cc: emacs-orgmode@gnu.org, Eric Schulte Hello, Brett Viren writes: > Eric Schulte 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