From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Berry Subject: Re: macro expansion in source code Date: Thu, 29 Aug 2013 15:15:08 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF3wf-0001WB-6s for emacs-orgmode@gnu.org; Thu, 29 Aug 2013 11:15:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VF3wX-00007I-Pg for emacs-orgmode@gnu.org; Thu, 29 Aug 2013 11:15:37 -0400 Received: from plane.gmane.org ([80.91.229.3]:49537) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF3wX-000071-BH for emacs-orgmode@gnu.org; Thu, 29 Aug 2013 11:15:29 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VF3wV-0007Bc-Aw for emacs-orgmode@gnu.org; Thu, 29 Aug 2013 17:15:27 +0200 Received: from 137.110.33.128 ([137.110.33.128]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 Aug 2013 17:15:27 +0200 Received: from ccberry by 137.110.33.128 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 Aug 2013 17:15:27 +0200 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: emacs-orgmode@gnu.org Johannes Rainer gmail.com> writes: > > > hi, > I was just wondering if there is a way to use macro expansion also in > source code blocks or headers. I tried this, but the macro was never > expanded, but rather the {{{image_width}}} was exported. could the > expansion be done by calling the macro expansion before export > (e.g. using a hook)? > > something like this: [snip] I think the answer is no. But you can accomplish much the same thing with properties and/or noweb references. Like this * header :PROPERTIES: :image_width: 16 :END: #+NAME: imwide #+HEADER: :var iw=(org-entry-get (point) "image_width") #+BEGIN_SRC R :results value iw #+END_SRC #+RESULTS: imwide : 16 #+BEGIN_SRC R :noweb yes :results output image.width <- <> image.width #+END_SRC #+RESULTS: : [1] 16