emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thomas S. Dye <tsd@tsdye.com>
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: Generate BEGIN_EXAMPLE block dynamically during export
Date: Tue, 16 Feb 2016 11:03:44 -1000	[thread overview]
Message-ID: <m2ziv0weof.fsf@tsdye.com> (raw)
In-Reply-To: <CAFyQvY3z0JUSBPeK1B3G+r7h9Np1V+SOqce3_uExwYaSJ4SnvA@mail.gmail.com>

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	other threads:[~2016-02-16 21:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 19:10 Generate BEGIN_EXAMPLE block dynamically during export Kaushal Modi
2016-02-16 20:02 ` Thomas S. Dye
2016-02-16 20:51   ` Kaushal Modi
2016-02-16 21:03     ` Thomas S. Dye [this message]
2016-02-16 21:16       ` Kaushal Modi
2016-02-16 21:47         ` Kaushal Modi
2016-02-16 22:18           ` Thomas S. Dye
2016-02-16 22:20             ` Kaushal Modi
2016-02-16 22:28           ` Nick Dokos
2016-02-16 22:40             ` Kaushal Modi
2016-02-16 23:10               ` Kaushal Modi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2ziv0weof.fsf@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=kaushal.modi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).