all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Sean O'Halpin" <sean.ohalpin@gmail.com>
To: tony day <zygomega@gmail.com>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Macro and babel
Date: Wed, 19 Sep 2012 07:54:06 +0100	[thread overview]
Message-ID: <CAOXM+eUsQmWGbiHct8wtO6QL7_t-HXwM3XuTke4+ZwX34WwshQ@mail.gmail.com> (raw)
In-Reply-To: <4A8C5CE2-9159-49BB-A6F9-1FB8B8EAD154@gmail.com>

On Wed, Sep 19, 2012 at 1:54 AM, tony day <zygomega@gmail.com> 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

  reply	other threads:[~2012-09-19  6:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18 21:30 Habit setup help needed Robert Horn
2012-09-19  0:54 ` Macro and babel tony day
2012-09-19  6:54   ` Sean O'Halpin [this message]
2012-09-19  8:01 ` Habit setup help needed Bastien
2012-09-19 10:55   ` Robert Horn
2012-09-20 11:14 ` Memnon Anon
2012-09-20 14:40   ` Robert Horn

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

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

  git send-email \
    --in-reply-to=CAOXM+eUsQmWGbiHct8wtO6QL7_t-HXwM3XuTke4+ZwX34WwshQ@mail.gmail.com \
    --to=sean.ohalpin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=zygomega@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.