emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Replace macros on tangle
@ 2017-06-26 14:48 Giacomo M
  2017-06-26 16:36 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Giacomo M @ 2017-06-26 14:48 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

Dear all,
how can I add macro replacement support when a source block is being 
tangled?
Thanks,
Giacomo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Replace macros on tangle
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2017-06-26 16:36 UTC (permalink / raw)
  To: Giacomo M; +Cc: emacs-orgmode@gnu.org

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.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Replace macros on tangle
  2017-06-26 16:36 ` Nicolas Goaziou
@ 2017-06-26 17:06   ` Charles C. Berry
  2017-06-27 10:14     ` Giacomo M
  0 siblings, 1 reply; 4+ messages in thread
From: Charles C. Berry @ 2017-06-26 17:06 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Giacomo M, emacs-orgmode@gnu.org

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Replace macros on tangle
  2017-06-26 17:06   ` Charles C. Berry
@ 2017-06-27 10:14     ` Giacomo M
  0 siblings, 0 replies; 4+ messages in thread
From: Giacomo M @ 2017-06-27 10:14 UTC (permalink / raw)
  To: Charles C. Berry, Nicolas Goaziou; +Cc: emacs-orgmode@gnu.org

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-27 10:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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).