Re: [O] Programmatically constructing org documents

2016-06-27 Thread Arun Isaac
> https://github.com/tj64/org-dp I've seen org-dp before, but I'm confused about how it is different from org-element functions like `org-element-interpret-data'. Does it just add more convenience functions? If so, why not integrate org-dp into org-mode itself? Surely, convenience functions

Re: [O] Programmatically constructing org documents

2016-06-27 Thread Samuel W. Flint
Does something like this do what you're looking for? https://github.com/tj64/org-dp HTH, Sam -- Samuel W. Flint 4096R/266596F4 (9477 D23E 389E 40C5 2F10 DE19 68E5 318E 2665 96F4) (λs.s s) λs.s s

Re: [O] Programmatically constructing org documents

2016-06-27 Thread John Kitchin
Cool, thanks for the tip. So, you can build a table like this: #+BEGIN_SRC emacs-lisp (org-element--interpret-data-1 '((table (:caption "Some interesting thing.") (table-row '() (table-cell '() ("5")) (table-cell '() ("6")))

Re: [O] Programmatically constructing org documents

2016-06-27 Thread Charles C. Berry
On Mon, 27 Jun 2016, John Kitchin wrote: After some more thought, I am not sure it is possible to setup just a parse tree for this. It works ok for src blocks, e.g. [deleted] On the other hand, it isn't clear how to use this to make a table. e.g. this table: | 5 | 6 | | 6 | 7 | was

Re: [O] Programmatically constructing org documents

2016-06-27 Thread John Kitchin
After some more thought, I am not sure it is possible to setup just a parse tree for this. It works ok for src blocks, e.g. #+BEGIN_SRC emacs-lisp (org-element--interpret-data-1 '(src-block (:language "emacs-lisp" :switches nil :parameters ":results code" :value "(org-element-context)\n"

Re: [O] Programmatically constructing org documents

2016-06-26 Thread Arun Isaac
> I don't know if there is a "correct" way. It might depend on how > sophisticated the document is. I usually use strings and format. > Sometimes that is a pain though, if there is a lot of conditional > formatting. So the question is which is easier for your situation, and I > would say easier

Re: [O] Programmatically constructing org documents

2016-06-26 Thread John Kitchin
I don't know if there is a "correct" way. It might depend on how sophisticated the document is. I usually use strings and format. Sometimes that is a pain though, if there is a lot of conditional formatting. So the question is which is easier for your situation, and I would say easier is "correct"

[O] Programmatically constructing org documents

2016-06-24 Thread Arun Isaac
What is the "correct" way to programmatically construct org documents? Should I construct a parse tree, and then use `org-element-interpret-data' to convert it org syntax? Or, should I use string and buffer functions (such as `format' and `insert') to construct org syntax directly? Thank you,