Hello,

On Mon, Apr 18, 2005 at 06:44:31PM -0700, Paul Eggert wrote:
> Alexandre Duret-Lutz <[EMAIL PROTECTED]> writes:
> 
> > I remember that using @<:@ in AS_HELP_STRING was wrong because
> > that macros count the number of characters in its arguments to
> > reformat the string; so @<:@ is counted as 4 characters but
> > output as one.
> >
> > Did this ever change?
> 
> If memory serves, Noah Misch fixed that in CVS Autoconf.

I'm afraid the issue is not fixed yet.  I see no such code in
AS_HELP_STRING not m4_text_wrap, and I recently experienced problems
with quadrigraphs in $1 of AS_HELP_STRING.

(But CVS contains macro m4_qlen, which counts the number of characters
with respect to quadrigraphs.)

> > In fact I think there is no point in writing things like
> > "default=disabled" or "default=enabled".  Simply showing the
> > option form (--without or --with) that is not the default looks
> > clear enough to me.

Yes, but it's not clear what should be used if the default is "auto".
gnumeric, for example, uses --{with,without}-foo in this situation.

The attached patch contains a fix to this issue; moreover, it adds
FIXMEs to the comments above AS_HELP_STRING and m4_text_wrap.
(The patch passed "make check".)

OK to commit?

Have a nice day,
        Stepan
2005-04-19  Stepan Kasal  <[EMAIL PROTECTED]>

        * doc/autoconf.texi (External Software): Quadrigraphs are not
          processed correctly in AS_HELP_STRING; avoid this in the examples.
        * lib/m4sugar/m4sh.m4 (AS_HELP_STRING): Add a FIXME about quadrigraphs.
        * lib/m4sugar/m4sugar.m4 (m4_text_wrap): Likewise; and rephrase the
          comment and reduce m4_default([foo], []) to [foo].

Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.887
diff -u -r1.887 autoconf.texi
--- doc/autoconf.texi   14 Apr 2005 14:56:55 -0000      1.887
+++ doc/autoconf.texi   19 Apr 2005 07:04:11 -0000
@@ -13322,8 +13322,8 @@
 @c FIXME: Remove AS_IF when the problem of AC_REQUIRE within `if' is solved.
 @example
 AC_ARG_WITH(readline,
-  [AS_HELP_STRING(--with-readline,
-    [support fancy command line editing @@<:@@default=check@@:>@@])],
+  [AS_HELP_STRING([EMAIL PROTECTED],[EMAIL PROTECTED],
+    [force whether support for fancy command line editing is used])],
   [],
   with_readline=check)
 
@@ -13347,7 +13347,7 @@
 @example
 AC_ARG_WITH(readline,
   [AS_HELP_STRING(--with-readline,
-    [enable experimental support for readline @@<:@@default=disabled@@:>@@])],
+    [enable experimental support for readline])],
   [],
   with_readline=no)
 
@@ -13369,7 +13369,7 @@
 @example
 AC_ARG_WITH(readline,
   [AS_HELP_STRING(--without-readline,
-    [disable support for readline @@<:@@default=enabled@@:>@@])],
+    [disable support for readline])],
   [],
   with_readline=yes)
 
Index: lib/m4sugar/m4sh.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v
retrieving revision 1.137
diff -u -r1.137 m4sh.m4
--- lib/m4sugar/m4sh.m4 23 Feb 2005 19:26:35 -0000      1.137
+++ lib/m4sugar/m4sh.m4 19 Apr 2005 07:04:11 -0000
@@ -1058,6 +1058,18 @@
 #  | column 2                |
 #  column 0                  column 26
 #
+#
+# FIXME: Handle quadrigraphs in LHS correctly.
+# another one:
+# FIXME: the m4_text_wrap interface design seems to be wrong.  I see two ways:
+# 1) m4_text_wrap could pad the FIRST_PREFIX to the length of PREFIX; then
+#    there would be no need to handle quadrigraphs in AS_HELP_STRING.
+# 2) The special case when FIRST_PREFIX is longer than PREFIX could be moved
+#    from m4_text_wrap here; then one could call
+#      m4_text_wrap(TEXT, [], [    ])
+#    to get an indented paragraph.
+# My first impression is that 2) is better.  --kasal 19apr05
+#
 m4_define([AS_HELP_STRING],
 [m4_pushdef([AS_Prefix], m4_default([$3], [                          ]))dnl
 m4_pushdef([AS_Prefix_Format],
Index: lib/m4sugar/m4sugar.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sugar.m4,v
retrieving revision 2.84
diff -u -r2.84 m4sugar.m4
--- lib/m4sugar/m4sugar.m4      19 Apr 2005 06:20:38 -0000      2.84
+++ lib/m4sugar/m4sugar.m4      19 Apr 2005 07:04:12 -0000
@@ -1511,10 +1511,10 @@
 # m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH])
 # -------------------------------------------------------
 # Expands into STRING wrapped to hold in WIDTH columns (default = 79).
-# If prefix is set, each line is prefixed with it.  If FIRST-PREFIX is
-# specified, then the first line is prefixed with it.  As a special
-# case, if the length of the first prefix is greater than that of
-# PREFIX, then FIRST-PREFIX will be left alone on the first line.
+# If PREFIX is given, each line is prefixed with it.  If FIRST-PREFIX is
+# specified, then the first line is prefixed with it.  As a special case,
+# if the length of FIRST-PREFIX is greater than that of PREFIX, then
+# FIRST-PREFIX will be left alone on the first line.
 #
 # Typical outputs are:
 #
@@ -1541,12 +1541,15 @@
 # we really want to bother with people trying each single corner
 # of a software?
 #
+# more important:
+# FIXME: handle quadrigraphs correctly, both in TEXT and in FIRST_PREFIX.
+#
 # This macro does not leave a trailing space behind the last word,
 # what complicates it a bit.  The algorithm is stupid simple: all the
 # words are preceded by m4_Separator which is defined to empty for the
 # first word, and then ` ' (single space) for all the others.
 m4_define([m4_text_wrap],
-[m4_pushdef([m4_Prefix], m4_default([$2], []))dnl
+[m4_pushdef([m4_Prefix], [$2])dnl
 m4_pushdef([m4_Prefix1], m4_default([$3], [m4_Prefix]))dnl
 m4_pushdef([m4_Width], m4_default([$4], 79))dnl
 m4_pushdef([m4_Cursor], m4_len(m4_Prefix1))dnl

Reply via email to