Bruno Haible <bruno <at> clisp.org> writes: > I'm convinced now. Thanks for showing these effects. Probably I got > confused by the name and it should better be called m4_concat_args. > For a single argument, even unquoted, m4_quote appears to be a nop:
It depends on whether that single argument is an unquoted macro call (or a parameter expansion like $1) which might expand to multiple arguments. In other words, use m4_quote when you are not sure whether what you are enclosing might expand to a raw comma, but when you also don't care about whitespace after raw commas. Use the (more expensive, and only available in newer autoconf) better m4_expand if you do care about whitespace. And use m4_defn ([var]), not m4_quote(var), to grab the contents of a macro used to store an arbitrary string. You're right that m4_quote has very little use when writing m4sugar to be as robust as possible (m4_dquote, on the other hand, is very important). $ m4 -Ilib m4sugar/m4sugar.m4 - m4_divert m4_define([a], [A, B]) a A, B m4_quote(a) A,B m4_expand([a]) A, B m4_len(a) m4:stdin:6: warning: m4_len: extra arguments ignored: 2 > 1 1 m4_len(m4_quote(a)) 3 m4_len(m4_expand([a])) 4 -- Eric Blake
