emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Generate BEGIN_EXAMPLE block dynamically during export


From: Thomas S . Dye
Subject: Re: [O] Generate BEGIN_EXAMPLE block dynamically during export
Date: Tue, 16 Feb 2016 11:03:44 -1000
User-agent: mu4e 0.9.17; emacs 24.5.1

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 would like to not manually update the
> tar-file arg in all those.
> Below does not work because the {{{TAR_FILE}}} macro does not get expanded
> in the #+CALL line.
>
> #+MACRO: TAR_FILE some_file.tar.gz
>
> #+NAME: tar-eg
> #+HEADER: :var tar-file="" :exports none
> #+BEGIN_SRC emacs-lisp
> (format "> tar xzvf %s" tar-file)
> #+END_SRC
>
> #+CALL: tar-eg(tar-file="{{{TAR_FILE}}}") :wrap example :exports results

Perhaps this?

,--------------------------------------------------------------
| #+PROPERTY: header-args:emacs-lisp :var tar-file="bar.tar.gz"
|                                                              
| #+name: tar-eg                                               
| #+begin_src emacs-lisp                                       
| (format "> tar xzvf %s" tar-file)                            
| #+end_src                                                    
|                                                              
| #+CALL: tar-eg() :wrap example :exports results              
|                                                              
| #+results:                                                   
| #+BEGIN_example                                              
| > tar xzvf bar.tar.gz                                        
| #+END_example                                                
`--------------------------------------------------------------

hth,
Tom


-- 
Thomas S. Dye
http://www.tsdye.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]