emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Giacomo M <jackjackk@gmail.com>
To: "Charles C. Berry" <ccberry@ucsd.edu>,
	Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Replace macros on tangle
Date: Tue, 27 Jun 2017 12:14:42 +0200	[thread overview]
Message-ID: <c968a152-33a0-2874-0aed-74cf12dcc944@gmail.com> (raw)
In-Reply-To: <alpine.OSX.2.20.1706260949340.776@charles-berrys-macbook.local>

Dear Nicolas and Chuck,

thanks for pointing me in the right direction. I never thought that 
macros were actually just an export feature, and that noweb replacements 
could be used as macros!

I am experiencing a little quirk though. Since I often edit this org 
file under Windows, the tangled files have Windows new lines, and 
(cygwin or any) bash doesn't like it. So I added a 
org-babel-post-tangle-hook that set-buffer-file-coding-system to unix. 
But the scripts that I tangle with a noweb ref end up with a weird ^M 
after each end of line. It seems this happens after the post-tangle 
hook. How could I take care of those ^M?

Thanks a lot,

Giacomo


Il 6/26/2017 7:06 PM, Charles C. Berry ha scritto:
> On Mon, 26 Jun 2017, Nicolas Goaziou wrote:
>
>> Hello,
>>
>> Giacomo M <jackjackk@gmail.com> writes:
>>
>>> Dear all,
>>> how can I add macro replacement support when a source block is being
>>> tangled?
>>
>> I don't think so. Macro replacement is an export feature.
>
> If Giacomo's macros operate outside of src blocks, he could export 
> using `org-org-export-to-org', then tangle the resulting file.
>
> Giacomo, if you want something to operate inside of src blocks you can 
> use noweb replacements that execute code as outlined in
>
>     (info "(org) Noweb reference syntax")
>
> In a way these are like macros.
>
> HTH,
>
> Chuck

      reply	other threads:[~2017-06-27 10:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-26 14:48 Replace macros on tangle Giacomo M
2017-06-26 16:36 ` Nicolas Goaziou
2017-06-26 17:06   ` Charles C. Berry
2017-06-27 10:14     ` Giacomo M [this message]

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=c968a152-33a0-2874-0aed-74cf12dcc944@gmail.com \
    --to=jackjackk@gmail.com \
    --cc=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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).