bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] maint: indent with spaces, not TABs, and add a rule to check


From: Jim Meyering
Subject: Re: [PATCH] maint: indent with spaces, not TABs, and add a rule to check this
Date: Tue, 05 Jul 2011 10:23:10 +0200

Bruno Haible wrote:
>>     m4/po.m4
>>     *** indent with spaces, not TABs;
>> ...
>> Bruno, I didn't change po.m4, since it's from gettext.
>> If you plan to fix it, I'll leave the failure for now.
>> Otherwise, let me know and I'll exempt that file, too.
>
> The leading tabs in m4/po.m4 are not indentation, but rather pieces of
> Makefiles, and Makefiles need to have lines that start with a tab.
> Therefore, please, exempt that file.

Hi Bruno,

You may assume that I know about TABs and Makefiles ;-)
If you simply do not want to change that file, that is fine.  Just say so.
I've included a patch below (it applies to gnulib, but I suppose it
would go in gettext if you'd like to make the change).

>> Also, regarding the cpp indentation in stdio-read.c and stdio-write.c,
>> would you prefer to exempt those two files or to indent the offending
>> #undef directives?
>
> Code like
>
>   char *
>   gets (char *s)
>   #undef gets
>   {
>     ...
>   }
>
> has pretty much become an idiom in gnulib. I'd like to keep it as-is.
> Therefore, can you please exempt these two files as well?

Ok.

It is trivial to avoid leading TABs in a script
that emits a Makefile snippet with leading TABs.
Here's one way that is perhaps minimally invasive:
The change replaces each explicit leading TAB with 8 leading
spaces and converts each "cat" to a sed command that performs
the desired 8-sp-to-TAB mapping.  Thus, there is no change
to the emitted Makefile snippets.

>From af998ddfaa07039f0d3351238a887c5c86242efb Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 5 Jul 2011 09:06:39 +0200
Subject: [PATCH] maint: avoid leading TABs and space-before-TAB

* m4/po.m4 (AM_POSTPROCESS_PO_MAKEFILE): Avoid leading TABs.
(AM_PO_SUBDIRS): Use TAB-space in regex, rather than space-TAB, since
the latter is likely to trigger a useless-space-before-TAB warning.
---
 ChangeLog |    7 +++++++
 m4/po.m4  |   16 ++++++++--------
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 88eca79..e57c215 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-07-05  Jim Meyering  <address@hidden>
+
+       maint: avoid leading TABs and space-before-TAB
+       * m4/po.m4 (AM_POSTPROCESS_PO_MAKEFILE): Avoid leading TABs.
+       (AM_PO_SUBDIRS): Use TAB-space in regex, rather than space-TAB, since
+       the latter is likely to trigger a useless-space-before-TAB warning.
+
 2011-07-04  Jim Meyering  <address@hidden>

        maint: indent with spaces, not TABs, and add a rule to check this
diff --git a/m4/po.m4 b/m4/po.m4
index a3e99d6..cd2cccb 100644
--- a/m4/po.m4
+++ b/m4/po.m4
@@ -1,4 +1,4 @@
-# po.m4 serial 17 (gettext-0.18)
+# po.m4 serial 18 (gettext-0.18)
 dnl Copyright (C) 1995-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -118,7 +118,7 @@ changequote([,])dnl
         if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
           rm -f "$ac_dir/POTFILES"
           test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo 
"creating $ac_dir/POTFILES"
-          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[  
]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > 
"$ac_dir/POTFILES"
+          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[  
 ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > 
"$ac_dir/POTFILES"
           POMAKEFILEDEPS="POTFILES.in"
           # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
           # on $ac_dir but don't depend on user-specified configuration
@@ -409,10 +409,10 @@ changequote([,])dnl
     # Add dependencies that cannot be formulated as a simple suffix rule.
     for lang in $ALL_LINGUAS; do
       frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 
'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
-      cat >> "$ac_file.tmp" <<EOF
+      sed 's/^        /        /' >> "$ac_file.tmp" <<EOF
 $frobbedlang.msg: $lang.po
-       @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
-       \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm 
-f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+        @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; 
\
+        \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { 
rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
 EOF
     done
   fi
@@ -420,10 +420,10 @@ EOF
     # Add dependencies that cannot be formulated as a simple suffix rule.
     for lang in $ALL_LINGUAS; do
       frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 
's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 
's/^uz-UZ$/uz-UZ-Latn/'`
-      cat >> "$ac_file.tmp" <<EOF
+      sed 's/^        /        /' >> "$ac_file.tmp" <<EOF
 $frobbedlang/\$(DOMAIN).resources.dll: $lang.po
-       @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po 
-r \$(DOMAIN)"; \
-       \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r 
"\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+        @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang 
$srcdirpre$lang.po -r \$(DOMAIN)"; \
+        \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r 
"\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
 EOF
     done
   fi
--
1.7.6.370.gfeac5



reply via email to

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