Re: [O] Generate BEGIN_EXAMPLE block dynamically during export

2016-02-16 Thread Kaushal Modi
This seems to work from my brief testing: #+AUTHOR: #+OPTIONS: toc:nil #+PROPERTY: header-args:emacs-lisp :var tar-file="bar.tar.gz" :exports none #+NAME: tar-eg #+BEGIN_SRC emacs-lisp (let ((contents (format "> tar xzvf %s" tar-file))) (with-temp-buffer (insert contents) (write

Re: [O] Generate BEGIN_EXAMPLE block dynamically during export

2016-02-16 Thread Kaushal Modi
This is turning out to be more complicated than I anticipated .. I need to (1) Export the evaluated emacs-lisp block to a separate file, and (2) also include the result in the same document I can do that but it is a multi-step process: (1) First I need to export the result to the file only. I ca

Re: [O] Generate BEGIN_EXAMPLE block dynamically during export

2016-02-16 Thread Nick Dokos
Kaushal Modi writes: > OK, now I have just one follow up question. I would like to tangle the result > to a separate file. > > So I am looking for a way to save the result "> tar xvzf bar.tar.gz" to a > separate file. I tried adding > ":tangle filename" to #+CALL/#+BEGIN_SRC but that did not he

Re: [O] Generate BEGIN_EXAMPLE block dynamically during export

2016-02-16 Thread Kaushal Modi
I finally have this working! #+PROPERTY: header-args:emacs-lisp :var tar-file="bar.tar.gz" :exports none :file "results.txt" #+NAME: tar-eg #+BEGIN_SRC emacs-lisp (format "> tar xzvf %s" tar-file) #+END_SRC #+CALL: tar-eg() :wrap example :exports none #+CAPTION: =results.txt= #+NAME: code__resu

Re: [O] Generate BEGIN_EXAMPLE block dynamically during export

2016-02-16 Thread Thomas S . Dye
Aloha Kaushal, Kaushal Modi writes: > OK, now I have just one follow up question. I would like to tangle the > result to a separate file. > > So I am looking for a way to save the result "> tar xvzf bar.tar.gz" to a > separate file. I tried adding ":tangle filename" to #+CALL/#+BEGIN_SRC but > th

Re: [O] Generate BEGIN_EXAMPLE block dynamically during export

2016-02-16 Thread Kaushal Modi
OK, now I have just one follow up question. I would like to tangle the result to a separate file. So I am looking for a way to save the result "> tar xvzf bar.tar.gz" to a separate file. I tried adding ":tangle filename" to #+CALL/#+BEGIN_SRC but that did not help. Adding to #+CALL does not do any

Re: [O] Generate BEGIN_EXAMPLE block dynamically during export

2016-02-16 Thread Kaushal Modi
That works perfectly! Thank you! Just to add that I had to have "#+HEADER: :exports none" as I did not want the elisp code to be visible in the exported documents. #+PROPERTY: header-args:emacs-lisp :var tar-file="bar.tar.gz" #+NAME: tar-eg #+HEADER: :exports none #+BEGIN_SRC emacs-lisp (format

Re: [O] Generate BEGIN_EXAMPLE block dynamically during export

2016-02-16 Thread Thomas S . Dye
Aloha Kaushal, Kaushal Modi writes: > Thanks Tom. > > Your solution almost gets me there but I still need to manually update the > tar-file argument value in the #+CALL lines. > > What I am looking for is for something like below to work (but it isn't). I > have multiple such #+CALL lines and I w

Re: [O] Generate BEGIN_EXAMPLE block dynamically during export

2016-02-16 Thread Kaushal Modi
Thanks Tom. Your solution almost gets me there but I still need to manually update the tar-file argument value in the #+CALL lines. What I am looking for is for something like below to work (but it isn't). I have multiple such #+CALL lines and I would like to not manually update the tar-file arg

Re: [O] Generate BEGIN_EXAMPLE block dynamically during export

2016-02-16 Thread Thomas S . Dye
Aloha Kaushal, Kaushal Modi writes: > Hi all, > > I'd like to have an EXAMPLE block in my org file whose value is set using > something like an org macro at the time of export. > > So, something like: > > #+MACRO TAR_FILE some_file.tar.gz > > #+BEGIN_EXAMPLE >> tar xvzf {{{TAR_FILE}}} > #+END_EXA

[O] Generate BEGIN_EXAMPLE block dynamically during export

2016-02-16 Thread Kaushal Modi
Hi all, I'd like to have an EXAMPLE block in my org file whose value is set using something like an org macro at the time of export. So, something like: #+MACRO TAR_FILE some_file.tar.gz #+BEGIN_EXAMPLE > tar xvzf {{{TAR_FILE}}} #+END_EXAMPLE As the above is not possible, what would be a good