From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Invalid read syntax (#) in org-element parse tree Date: Mon, 11 Feb 2013 22:47:49 +0100 Message-ID: <87fw12cyka.fsf@gmail.com> References: <87vc9ybt65.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:53079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U51EO-0008SA-LY for emacs-orgmode@gnu.org; Mon, 11 Feb 2013 16:48:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U51EM-0006do-7w for emacs-orgmode@gnu.org; Mon, 11 Feb 2013 16:48:08 -0500 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:55796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U51EM-0006dH-1U for emacs-orgmode@gnu.org; Mon, 11 Feb 2013 16:48:06 -0500 Received: by mail-wi0-f170.google.com with SMTP id hm11so3853732wib.5 for ; Mon, 11 Feb 2013 13:48:05 -0800 (PST) In-Reply-To: <87vc9ybt65.fsf@gmail.com> (Thorsten Jolitz's message of "Mon, 11 Feb 2013 19:29:38 +0100") 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: Thorsten Jolitz Cc: emacs-orgmode@gnu.org Hello, Thorsten Jolitz 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(#) > | 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