emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Thorsten Jolitz <tjolitz@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Invalid read syntax (#) in org-element parse tree
Date: Mon, 11 Feb 2013 22:47:49 +0100	[thread overview]
Message-ID: <87fw12cyka.fsf@gmail.com> (raw)
In-Reply-To: <87vc9ybt65.fsf@gmail.com> (Thorsten Jolitz's message of "Mon, 11 Feb 2013 19:29:38 +0100")

Hello,

Thorsten Jolitz <tjolitz@gmail.com> writes:

> here is an excerpt of a parse tree produced with
> 'org-element-parse-buffer': 
>
> ,-------------------------------------------------------------
> | (section (:begin 1 :end 624 :contents-begin
> | 1 :contents-end 623 :post-blank 1 :parent #0) (keyword (:key
> | TITLE :value Program "Blues for Icke" :begin 1 :end
> | 39 :post-blank 0 :post-affiliated 1 :parent #1)))
> `-------------------------------------------------------------
>
> When I evaluate a function with this list as data, I get an error:
>
> ,--------------------------------------------------------
> | Debugger entered--Lisp error: (invalid-read-syntax "#")
> |   read(#<buffer *scratch*>)
> |   preceding-sexp()
> |   eval-last-sexp-1(t)
> |   eval-last-sexp(t)
> |   eval-print-last-sexp()
> |   call-interactively(eval-print-last-sexp nil nil)
> `--------------------------------------------------------

[...]

> There are a lot of usages of '#' in Emacs Lisp, but I couldn't figure
> out how (and why) it is used in ':parent #1'. 

See (info "(elisp) Read Syntax for Circular Objects")

> Nic Ferrier wrote an exhaustive library with "routines for working with
> key/value data structures like hash-tables and alists and plists"
> (https://github.com/nicferrier/emacs-kv/blob/master/kv.el), but I cannot
> apply any of the functions due to the read error. Do I really have to
> treat the parse tree as text first and eliminate the '#' before I can
> use it as list in Emacs Lisp, or did I simply manage to get the wrong
> represantation of the parse tree somehow?

I'm not sure about what you want to do with the parse tree. The usual
function to work with it is `org-element-map'. You may want to have
a look at its docstring, as it contains examples.


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2013-02-11 21:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-11 18:29 Invalid read syntax (#) in org-element parse tree Thorsten Jolitz
2013-02-11 21:47 ` Nicolas Goaziou [this message]
2013-02-11 23:20   ` Thorsten Jolitz
2013-02-12 19:41     ` Nicolas Goaziou
2013-02-12 20:47       ` Thorsten Jolitz
2013-02-12 20:56         ` Thorsten Jolitz

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=87fw12cyka.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tjolitz@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).