[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Macro and babel
From: |
Sean O'Halpin |
Subject: |
Re: [O] Macro and babel |
Date: |
Wed, 19 Sep 2012 07:54:06 +0100 |
On Wed, Sep 19, 2012 at 1:54 AM, tony day <address@hidden> wrote:
>
> I had written this:
>
> ,----
> | #+MACRO: testdir ~/working
> | #+begin_src sh
> | cd {{{testdir}}}
> | #+end_src
> `----
>
> Thinking it would do this:
>
> ,----
> | #+begin_src sh
> | cd ~/working
> | #+end_src
> `----
> Alas, #+Macro acts on export only.
>
> Is there a quick way to effect general text substitution on C-c C-c? That
> would be an awesome feature, basically adding macro capabilities to every
> babelable language. Or am I missing something?
>
>
> Tony
Here's a somewhat roundabout way of achieving something similar:
#+BEGIN_ORG
#+NAME: test-dir2
#+BEGIN_SRC sh :var dir="." :results output org :exports none
echo "
,#+begin_src sh
cd $dir
,#+end_src
"
#+END_SRC
#+CALL: test-dir2(dir="~/org") :results value raw :exports both
#+CALL: test-dir2(dir="/var/www/") :results value raw :exports both
#+END_ORG
HTH,
Sean