emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Brett Viren <bv@bnl.gov>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Org mode and "shunt" exporters?
Date: Mon, 09 Dec 2013 12:38:43 -0500	[thread overview]
Message-ID: <ir4bo0prkkc.fsf@lycastus.phy.bnl.gov> (raw)
In-Reply-To: <87zjoe7mf2.fsf@gmail.com> (Eric Schulte's message of "Thu, 05 Dec 2013 19:10:00 -0700")

[-- Attachment #1: Type: text/plain, Size: 1437 bytes --]

Eric Schulte <schulte.eric@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.


-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

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2013-12-09 17:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05 20:30 Org mode and "shunt" exporters? Brett Viren
2013-12-06  2:10 ` Eric Schulte
2013-12-09 17:38   ` Brett Viren [this message]
2013-12-09 19:55     ` Nicolas Goaziou
2013-12-13 18:26       ` Brett Viren
2013-12-13 19:05         ` Nicolas Goaziou
2013-12-13 19:29           ` Eric Schulte
2013-12-13 23:06             ` Brett Viren
2013-12-06 13:02 ` John Kitchin
2013-12-12 16:30   ` Brett Viren
2013-12-12 17:22     ` John Kitchin
2013-12-12 19:24       ` Eric Schulte
2013-12-12 19:50       ` Aaron Ecay
2013-12-12 19:58         ` Matt Price
2013-12-13  2:53           ` John Kitchin
2013-12-13 19:02           ` Brett Viren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ir4bo0prkkc.fsf@lycastus.phy.bnl.gov \
    --to=bv@bnl.gov \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).