From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas S. Dye Subject: Re: Generate BEGIN_EXAMPLE block dynamically during export Date: Tue, 16 Feb 2016 11:03:44 -1000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVmnB-0005GO-6u for emacs-orgmode@gnu.org; Tue, 16 Feb 2016 16:04:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVmn4-0000ja-48 for emacs-orgmode@gnu.org; Tue, 16 Feb 2016 16:04:17 -0500 Received: from gproxy8-pub.mail.unifiedlayer.com ([67.222.33.93]:60684) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1aVmn3-0000jF-T7 for emacs-orgmode@gnu.org; Tue, 16 Feb 2016 16:04:10 -0500 In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Kaushal Modi Cc: emacs-org list 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