m4-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to patsubst the result of an include?


From: Stepan Kasal
Subject: Re: How to patsubst the result of an include?
Date: Fri, 4 Feb 2005 14:46:35 +0100
User-agent: Mutt/1.4.1i

Hi,

On Fri, Feb 04, 2005 at 01:27:36PM +0000, Gary V. Vaughan wrote:
> > +   expandonce(`macro(a, b, c)')
> > +   expandonce(`include(`file')')

on a second thought, I think that the right syntax would be

        expandonce(`macro', a, b, c)
        expandonce(`include', `file')

or perhaps

        indirq(`macro', a, b, c)
        indirq(`include', `file')

The name `indirq' stands for `indir quoted', because expanding once is the
same as returning quoted body of the macro.  That's why I said it's similar
to `defn'--in fact, it's the same if the macro body doesn't contain any $.

> Instead, for the next release I want to come up with a mechanism for allowing
> macros to return their results quoted, though I haven't yet thought of a clean
> way to turn it on and off, or how much control is needed over what macros will
> be affected.  Once that has been implemented, include would be able to quote
> its own expansion.

I remember we discussed this, after I have forwarded you a note from Akim.
But now I think `indirq' is the right control mechanism.

If you wish that all includes return the body quoted, you can do

        define(`include_orig', defn(`include'))
        define(`include', `indirq(`include_orig', $1)')

and similarily for other builtins.

> Maybe there is some merit to expandonce too, but this isn't it :-)

Maybe `indir_quoted' is just better name than expandonce.  ;-)

Stepan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]