emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Invalid read syntax (#) in org-element parse tree
@ 2013-02-11 18:29 Thorsten Jolitz
  2013-02-11 21:47 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Thorsten Jolitz @ 2013-02-11 18:29 UTC (permalink / raw)
  To: emacs-orgmode


Hi List, 

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)
`--------------------------------------------------------

from the doc in 'org-element.el' I learn that:

,------------------------------------------------------------------------
| ;; Notwithstanding affiliated keywords, each greater element, element
| ;; and object has a fixed set of properties attached to it. [...]
| 
| ;; `:parent' which refers to the element or object containing it. [...]
| 
| ;; Lisp-wise, an element or an object can be represented as a list.
| ;; It follows the pattern (TYPE PROPERTIES CONTENTS), where:
| ;;   TYPE is a symbol describing the Org element or object.
| ;;   PROPERTIES is the property list attached to it.  See docstring of
| ;;              appropriate parsing function to get an exhaustive
| ;;              list.
| ;;   CONTENTS is a list of elements, objects or raw strings contained
| ;;            in the current element or object, when applicable.
| ;;
| ;; An Org buffer is a nested list of such elements and objects, whose
| ;; type is `org-data' and properties is 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'. 

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?

Thanks for any advice.

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-02-12 20:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-11 18:29 Invalid read syntax (#) in org-element parse tree Thorsten Jolitz
2013-02-11 21:47 ` Nicolas Goaziou
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

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).