Hello, Thorsten Jolitz <tjol...@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