# HG changeset patch # User Joel E. Denny # Date 1249047485 14400 # Node ID 803d728925f9ad22e72b94fe75afc3e5f72f4903 # Parent 392f877029a8d502c9c5d3e7f7786436ea01d387 update-copyright: handle leading tabs in line prefix * build-aux/update-copyright: Count leading tabs as 8 spaces when computing margin. This helps with the formatting of ChangeLogs, for example. Fix documentation a little. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-07-31 Joel E. Denny + + update-copyright: handle leading tabs in line prefix + * build-aux/update-copyright: Count leading tabs as 8 spaces + when computing margin. This helps with the formatting of + ChangeLogs, for example. + Fix documentation a little. + 2009-07-31 Joel E. Denny update-copyright: support EOL=\r\n diff --git a/build-aux/update-copyright b/build-aux/update-copyright --- a/build-aux/update-copyright +++ b/build-aux/update-copyright @@ -22,7 +22,7 @@ # The arguments to this script should be names of files that contain FSF # copyright statements to be updated. For example, you may wish to -# place a target like the following in your top-level makefile in your +# place a target like the following in the top-level makefile in your # project: # # .PHONY: update-copyright @@ -74,8 +74,8 @@ # The exact conditions that a file's FSF copyright statement must meet # to be recognized are listed below. They may seem slightly complex, # but you need not worry if some file in your project accidentally -# breaks one. The worse that can happen is a warning that the file was -# not updated. +# breaks one. The worst that can happen is that a file is not updated +# and a warning is issued. # # 1. The format is "Copyright (C)" (where "(C)" can be "(c)"), then a # list of copyright years, and then the name of the copyright @@ -106,6 +106,7 @@ my $holder = 'Free Software Foundation, Inc.'; my $prefix_max = 5; my $margin = 72; +my $tab_width = 8; # Unless the file consistently uses "\r\n" as the EOL, use "\n" instead. my $eol = /(?:^|[^\r])\n/ ? "\n" : "\r\n"; @@ -161,6 +162,9 @@ # Format within margin. my $new_wrapped; my $text_margin = $margin - length($prefix); + if ($prefix =~ /^(\t+)/) { + $text_margin -= length($1) * ($tab_width-1); + } while (length($new)) { if (($new =~ s/^(.{1,$text_margin})(?: |$)//)