Jambunathan K <kjambunat...@gmail.com> writes: > Thorsten Jolitz <tjol...@gmail.com> writes: > >> Nicolas Goaziou <n.goaz...@gmail.com> writes: >> >>> You don't need `org-data' type. The tree root doesn't have any property >>> anyway. >> >> I used that because I wanted the whole parse-tree as return value, but >> no matter what `org-element-map' returns, it changes the parse-tree by >> side-effects anyway, so I can just ignore the return value and use the >> modified parse-tree stored somewhere instead - right? > > I have a hard time trying to imagine what you are trying to do. You > should try to explain to us what you are trying to accomplish. > > Why are you storing a parse-tree?
I'm transforming a parse tree for my needs, using `org-element-map', but since this functions returns what it mapped and, as Nicolas pointed out, its kind of fruitless to map top-level 'org-data type (since it has no property list), I store the parse-tree in some global variable that gives me easy access to the whole (modified) parse-tree. But its not really about storing something, thats just for convenience. I can (and do) wrap `org-element-map' into a function that receives a complete parse-tree and returns a complete parse-tree after modifying some parts of it (without storing something). > What does the parse-tree store? its just about a complete parse-tree as produced by `org-element-parse-buffer' transformed into a different syntax in several steps. > Does the buffer of which it is a representation change, when the parse > tree changes. no, the parse-tree is only prepared to be digested by a different programming-language. > How are you trying to "use" the parse tree? Is it meant for one-way > or two-way conversion - i.e., interpretation or exportation. in the end it will be used for two-way conversion, but I'm still working on the "from-elisp-to-..." part (while learning how the org-mode parser and the export framework work). I don't want to talk too much about the project until I know its going to work out. When there is something tangible I will announce it... -- cheers, Thorsten