From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brett Viren Subject: Re: Org mode and "shunt" exporters? Date: Mon, 09 Dec 2013 12:38:43 -0500 Message-ID: References: <87zjoe7mf2.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]:40142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq4nW-00018V-MP for emacs-orgmode@gnu.org; Mon, 09 Dec 2013 12:39:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vq4nS-0004dZ-Bx for emacs-orgmode@gnu.org; Mon, 09 Dec 2013 12:39:10 -0500 Received: from smtpgw.bnl.gov ([2620:10a:0:3::30]:3099 helo=iron3.sec.bnl.local) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq4nS-0004Zh-7P for emacs-orgmode@gnu.org; Mon, 09 Dec 2013 12:39:06 -0500 In-Reply-To: <87zjoe7mf2.fsf@gmail.com> (Eric Schulte's message of "Thu, 05 Dec 2013 19:10:00 -0700") 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: Eric Schulte Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain 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. -Brett. [1] one must (setq print-circle t) to avoid emacs reader errors http://www.gnu.org/software/emacs/manual/html_node/elisp/Circular-Objects.html [2] http://comments.gmane.org/gmane.emacs.orgmode/65999 [3] http://web.mit.edu/dosathena/sandbox/emacs-19.28/lisp/cust-print.el [4] http://edward.oconnor.cx/2006/03/json.el --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlKmACMACgkQEixH2Z0dKCwOBwCfX3XXQIm22zGhJMS52d6psUUA bDgAoJmGEmzV0oIx/USYgQ6M3Zn2LWjA =WABV -----END PGP SIGNATURE----- --=-=-=--