-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Daniel Richard G. on 5/21/2007 1:43 AM: > In fact, it's a fairly simple patch. See attached for my stab at it. (Also, > there's a more straightforward test input file.) I did the two-arg > divert(), since that seems more natural than coming up with a new/separate > builtin for this. > > I think this fills a hole in the core m4 feature set---right now, as I > understand it, the only way to send text to a diversion is at the point > when the text is actually being written out. With this, you can send text > to a diversion in the same way that errprint() sends text to stderr: > immediately upon evaluation of the builtin. Without regard to the invoking > context.
I'm debating if some other solution might also be helpful, such as a builtin that adds an extra set of quotes only if it is called while currently parsing the arguments to a macro. And it is also worth considering the proposal for a qindir() builtin in the TODO file. But so far, it still seems like your solution of expanding the divert builtin to take a second argument of text that will be output to the specified diversion seems pretty slick. I'm not so sure about reverting back to the current diversion, mainly because it seems weird for divert(1,) to behave differently than divert(1), particularly in light of POSIX rules that extra arguments should be ignored. So if no one else comments in a couple of days, I will probably commit a variant of your patch to HEAD only which allows an optional second argument to divert that will be output immediately to the new diversion, but where the divert macro always changes the current diversion, as it has always done. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGUmdn84KuGfSFAYARAq1xAJ4s0uq1qZvRZ71OVJzerHR0iGd4nwCgzWd8 BmrKJnCCKSIzJL6tsRuVw+o= =NeJU -----END PGP SIGNATURE----- _______________________________________________ M4-discuss mailing list M4-discuss@gnu.org http://lists.gnu.org/mailman/listinfo/m4-discuss