Hi Jim, all, Here's the proposal for untabifying: - all *.m4 files, - all *.sh files, - all *.[chy] files except lib/reg*
The entire patch is at http://www.haible.de/bruno/gnu/gnulib-expand.diff.gz (768 KB). The interesting parts are below: 1) Changes to NEWS and README (thanks Paolo for the vim trick). *** NEWS.orig 2009-12-09 20:16:50.000000000 +0100 --- NEWS 2009-12-09 19:39:00.000000000 +0100 *************** *** 6,11 **** --- 6,15 ---- Date Modules Changes + 2009-12-09 * Most source code files have been converted to + indentation by spaces (rather than tabs). Patches + of gnulib source code needs to be updated. + 2009-12-09 link-warning The Makefile rules that use $(LINK_WARNING_H) now must contain an explicit dependency on $(LINK_WARNING_H). *** README.orig 2009-12-09 20:16:50.000000000 +0100 --- README 2009-12-09 19:36:18.000000000 +0100 *************** *** 110,115 **** --- 110,157 ---- projects' modules/ file. + Indent with spaces, not TABs + ---------------------------- + We use space-only indentation in nearly all files. This includes all + *.h, *.c, *.y files, except for the regex module. Makefile and ChangeLog + files are excluded, since TAB characters are part of their format. + + In order to tell your editor to produce space-only indentation, you + can use these instructions. + + * For Emacs: Add these lines to your Emacs initialization file + ($HOME/.emacs or similar): + + ;; In gnulib, indent with spaces everywhere (not TABs). + ;; Exceptions: Makefile and ChangeLog modes. + (add-hook 'find-file-hook '(lambda () + (if (and buffer-file-name + (string-match "/gnulib\\>" (buffer-file-name)) + (not (string-equal mode-name "Change Log")) + (not (string-equal mode-name "Makefile"))) + (setq indent-tabs-mode nil)))) + + * For vi (vim): Add these lines to your $HOME/.vimrc file: + + " Don't use tabs for indentation. Spacer are nicer to work with. + set expandtab + + For Makefile and ChangeLog files, compensate this by adding this to + your $HOME/.vim/after/indent/make.vim and + $HOME/.vim/after/indent/changelog.vim files: + + " Use tabs for indentation, regardless of the global setting. + set noexpandtab + + * For Eclipse: In the "Window|Preferences" dialog (or "Eclipse|Preferences" + dialog on MacOS), + 1. Under "General|Editors|Text Editors", select the "Insert spaces for tabs" + checkbox. + 2. Under "C/C++|Code Style", select a code style profile that has the + "Indentation|Tab policy" combobox set to "Spaces only", such as the + "GNU [built-in]" policy. + + How to add a new module ----------------------- * Add the header files and source files to lib/. 2) Files for which "expand -i" and "expand" differ and "expand -i" was chosen: m4/getloadavg.m4 m4/ldd.m4 m4/lib-ld.m4 m4/lib-prefix.m4 m4/po.m4 3) Files for which "expand -i" and "expand" differ and "expand" was chosen: build-aux/link-warning.h lib/accept4.c lib/acosl.c lib/alloca.c lib/argmatch.c lib/argmatch.h lib/argp-fmtstream.c lib/argp-fmtstream.h lib/argp.h lib/argp-help.c lib/argp-namefrob.h lib/argp-parse.c lib/argp-xinl.c lib/argz.c lib/argz.in.h lib/asinl.c lib/atanl.c lib/at-func.c lib/backupfile.h lib/base64.c lib/canonicalize.c lib/canonicalize-lgpl.c lib/chdir-long.h lib/cosl.c lib/c-strcasestr.c lib/cycle-check.h lib/des.c lib/diacrit.c lib/diffseq.h lib/dup3.c lib/error.c lib/error.h lib/euidaccess.c lib/fileblocks.c lib/filemode.c lib/fnmatch.c lib/fnmatch.in.h lib/fnmatch_loop.c lib/fpucw.h lib/fstrcmp.c lib/fsusage.c lib/fsusage.h lib/ftruncate.c lib/fts.c lib/fts_.h lib/getcwd.c lib/getdate.y lib/getdelim.c lib/getdomainname.c lib/gethostname.c lib/getloadavg.c lib/getndelim2.c lib/getopt1.c lib/getopt.c lib/getopt.in.h lib/getopt_int.h lib/getpass.c lib/getusershell.c lib/git-merge-changelog.c lib/glob.c lib/glob.in.h lib/glob-libc.h lib/hash.h lib/human.c lib/iconveh.h lib/idcache.c lib/inet_ntop.c lib/inet_pton.c lib/linebuffer.h lib/link.c lib/localename.c lib/logl.c lib/malloca.h lib/math.in.h lib/mbchar.c lib/mbchar.h lib/mbfile.h lib/mbiter.h lib/mbscasestr.c lib/mbsstr.c lib/mbswidth.h lib/mbuiter.h lib/md4.c lib/md5.c lib/md5.h lib/memcmp.c lib/mktime.c lib/modechange.c lib/mountlist.c lib/mountlist.h lib/netdb.in.h lib/obstack.c lib/obstack.h lib/openat-priv.h lib/poll.c lib/poll.in.h lib/printf-args.h lib/printf-parse.c lib/printf-parse.h lib/putenv.c lib/random_r.c lib/readtokens.c lib/readutmp.h lib/relocatable.c lib/rijndael-alg-fst.c lib/rijndael-api-fst.c lib/rijndael-api-fst.h lib/rmdir.c lib/savedir.c lib/select.c lib/setenv.c lib/sha1.c lib/sha256.c lib/sha512.c lib/sig2str.c lib/sincosl.c lib/sinl.c lib/spawnattr_setflags.c lib/spawni.c lib/spawn.in.h lib/stdio.in.h lib/stdio-write.c lib/stdlib.in.h lib/strcasestr.c lib/strftime.c lib/string.in.h lib/strptime.c lib/strsignal.c lib/strstr.c lib/strtod.c lib/strtok_r.c lib/strtoll.c lib/strtoul.c lib/sys_file.in.h lib/sys_socket.in.h lib/sys_stat.in.h lib/sys_times.in.h lib/tanl.c lib/tempname.c lib/tempname.h lib/tmpdir.c lib/trigl.c lib/tsearch.c lib/uniconv/u-conv-from-enc.h lib/uniconv/u-conv-to-enc.h lib/uninorm/decompose-internal.h lib/unistd.in.h lib/unsetenv.c lib/utimecmp.c lib/vasnprintf.c lib/xmalloca.h lib/xprintf.h m4/extensions.m4 m4/fpending.m4 m4/getcwd.m4 m4/host-os.m4 m4/include_next.m4 m4/ls-mntd-fs.m4 m4/mbstate_t.m4 m4/stdint.m4 m4/string_h.m4 tests/test-argmatch.c tests/test-array_list.c tests/test-array-mergesort.c tests/test-array_oset.c tests/test-avltreehash_list.c tests/test-avltree_list.c tests/test-avltree_oset.c tests/test-base64.c tests/test-binary-io.c tests/test-bitrotate.c tests/test-btowc.c tests/test-byteswap.c tests/test-canonicalize.c tests/test-canonicalize-lgpl.c tests/test-carray_list.c tests/test-c-ctype.c tests/test-ceilf1.c tests/test-ceilf2.c tests/test-ceill.c tests/test-copy-acl.c tests/test-copy-file.c tests/test-c-stack.c tests/test-c-strcasecmp.c tests/test-c-strcasestr.c tests/test-c-strncasecmp.c tests/test-c-strstr.c tests/test-dirname.c tests/test-dprintf-posix.c tests/test-dup3.c tests/test-duplocale.c tests/test-fbufmode.c tests/test-fchdir.c tests/test-fdopendir.c tests/test-fflush2.c tests/test-file-has-acl.c tests/test-filevercmp.c tests/test-flock.c tests/test-floorf1.c tests/test-floorf2.c tests/test-floorl.c tests/test-fnmatch.c tests/test-fopen.h tests/test-fpending.c tests/test-fprintf-posix.c tests/test-fpurge.c tests/test-freadable.c tests/test-freadahead.c tests/test-freadptr2.c tests/test-freadptr.c tests/test-freadseek.c tests/test-freopen.c tests/test-frexp.c tests/test-frexpl.c tests/test-fseek.c tests/test-fstrcmp.c tests/test-ftell.c tests/test-ftello.c tests/test-func.c tests/test-fwritable.c tests/test-fwriting.c tests/test-getdate.c tests/test-getdelim.c tests/test-getdtablesize.c tests/test-getline.c tests/test-getndelim2.c tests/test-getopt.c tests/test-glob.c tests/test-hash.c tests/test-iconv.c tests/test-iconv-utf.c tests/test-idpriv-drop.c tests/test-idpriv-droptemp.c tests/test-inet_ntop.c tests/test-inet_pton.c tests/test-i-ring.c tests/test-isblank.c tests/test-isfinite.c tests/test-isinf.c tests/test-isnan.c tests/test-isnand.h tests/test-isnanf.h tests/test-isnanl.h tests/test-ldexpl.c tests/test-linkedhash_list.c tests/test-linked_list.c tests/test-localename.c tests/test-lseek.c tests/test-mbmemcasecmp.c tests/test-mbmemcasecoll.c tests/test-mbrtowc.c tests/test-mbscasecmp.c tests/test-mbscasestr1.c tests/test-mbscasestr2.c tests/test-mbscasestr3.c tests/test-mbscasestr4.c tests/test-mbschr.c tests/test-mbscspn.c tests/test-mbsinit.c tests/test-mbsncasecmp.c tests/test-mbsnrtowcs.c tests/test-mbspbrk.c tests/test-mbspcasecmp.c tests/test-mbsrchr.c tests/test-mbsrtowcs.c tests/test-mbsspn.c tests/test-mbsstr1.c tests/test-mbsstr2.c tests/test-mbsstr3.c tests/test-memchr2.c tests/test-memchr.c tests/test-memcmp.c tests/test-memmem.c tests/test-memrchr.c tests/test-obstack-printf.c tests/test-pipe2.c tests/test-pipe-filter-gi1.c tests/test-pipe-filter-gi2-main.c tests/test-pipe-filter-ii1.c tests/test-pipe-filter-ii2-main.c tests/test-poll.c tests/test-popen.h tests/test-posixtm.c tests/test-printf-frexp.c tests/test-printf-frexpl.c tests/test-printf-posix.c tests/test-priv-set.c tests/test-quotearg.c tests/test-random_r.c tests/test-rawmemchr.c tests/test-rbtreehash_list.c tests/test-rbtree_list.c tests/test-rbtree_oset.c tests/test-round1.c tests/test-round2.c tests/test-roundf1.c tests/test-roundl.c tests/test-safe-alloc.c tests/test-sameacls.c tests/test-select.c tests/test-set-mode-acl.c tests/test-sigaction.c tests/test-signbit.c tests/test-snprintf.c tests/test-snprintf-posix.c tests/test-sprintf-posix.c tests/test-strcasestr.c tests/test-strerror.c tests/test-striconv.c tests/test-striconveha.c tests/test-striconveh.c tests/test-strsignal.c tests/test-strstr.c tests/test-strtod.c tests/test-strverscmp.c tests/test-trunc1.c tests/test-trunc2.c tests/test-truncf1.c tests/test-truncf2.c tests/test-truncl.c tests/test-uname.c tests/test-vasnprintf.c tests/test-vasnprintf-posix2.c tests/test-vasnprintf-posix.c tests/test-vasprintf.c tests/test-vasprintf-posix.c tests/test-vdprintf-posix.c tests/test-vfprintf-posix.c tests/test-vprintf-posix.c tests/test-vsnprintf.c tests/test-vsnprintf-posix.c tests/test-vsprintf-posix.c tests/test-wcrtomb.c tests/test-wcsnrtombs.c tests/test-wcsrtombs.c tests/test-wctype.c tests/test-wcwidth.c tests/test-xfprintf-posix.c tests/test-xmemdup0.c tests/test-xprintf-posix.c tests/test-xvasprintf.c tests/unicase/test-locale-language.c tests/unicase/test-mapping-part1.h tests/unicase/test-predicate-part1.h tests/unicase/test-u16-casecmp.c tests/unicase/test-u16-casecoll.c tests/unicase/test-u16-casefold.c tests/unicase/test-u16-is-cased.c tests/unicase/test-u16-is-casefolded.c tests/unicase/test-u16-is-lowercase.c tests/unicase/test-u16-is-titlecase.c tests/unicase/test-u16-is-uppercase.c tests/unicase/test-u16-tolower.c tests/unicase/test-u16-totitle.c tests/unicase/test-u16-toupper.c tests/unicase/test-u32-casecmp.c tests/unicase/test-u32-casecoll.c tests/unicase/test-u32-casefold.c tests/unicase/test-u32-is-cased.c tests/unicase/test-u32-is-casefolded.c tests/unicase/test-u32-is-lowercase.c tests/unicase/test-u32-is-titlecase.c tests/unicase/test-u32-is-uppercase.c tests/unicase/test-u32-tolower.c tests/unicase/test-u32-totitle.c tests/unicase/test-u32-toupper.c tests/unicase/test-u8-casecmp.c tests/unicase/test-u8-casecoll.c tests/unicase/test-u8-casefold.c tests/unicase/test-u8-is-cased.c tests/unicase/test-u8-is-casefolded.c tests/unicase/test-u8-is-lowercase.c tests/unicase/test-u8-is-titlecase.c tests/unicase/test-u8-is-uppercase.c tests/unicase/test-u8-tolower.c tests/unicase/test-u8-totitle.c tests/unicase/test-u8-toupper.c tests/unicase/test-ulc-casecmp.c tests/unicase/test-ulc-casecoll.c tests/uniconv/test-u16-conv-from-enc.c tests/uniconv/test-u16-conv-to-enc.c tests/uniconv/test-u16-strconv-from-enc.c tests/uniconv/test-u16-strconv-to-enc.c tests/uniconv/test-u32-conv-from-enc.c tests/uniconv/test-u32-conv-to-enc.c tests/uniconv/test-u32-strconv-from-enc.c tests/uniconv/test-u32-strconv-to-enc.c tests/uniconv/test-u8-conv-from-enc.c tests/uniconv/test-u8-conv-to-enc.c tests/uniconv/test-u8-strconv-from-enc.c tests/uniconv/test-u8-strconv-to-enc.c tests/unictype/test-bidi_byname.c tests/unictype/test-bidi_name.c tests/unictype/test-bidi_of.c tests/unictype/test-bidi_test.c tests/unictype/test-block_list.c tests/unictype/test-block_of.c tests/unictype/test-block_test.c tests/unictype/test-categ_and.c tests/unictype/test-categ_and_not.c tests/unictype/test-categ_byname.c tests/unictype/test-categ_name.c tests/unictype/test-categ_none.c tests/unictype/test-categ_of.c tests/unictype/test-categ_or.c tests/unictype/test-categ_test_withtable.c tests/unictype/test-combining.c tests/unictype/test-decdigit.c tests/unictype/test-digit.c tests/unictype/test-mirror.c tests/unictype/test-numeric.c tests/unictype/test-pr_byname.c tests/unictype/test-predicate-part1.h tests/unictype/test-pr_test.c tests/unictype/test-scripts.c tests/unictype/test-sy_c_ident.c tests/unictype/test-sy_java_ident.c tests/unilbrk/test-u16-possible-linebreaks.c tests/unilbrk/test-u16-width-linebreaks.c tests/unilbrk/test-u32-possible-linebreaks.c tests/unilbrk/test-u32-width-linebreaks.c tests/unilbrk/test-u8-possible-linebreaks.c tests/unilbrk/test-u8-width-linebreaks.c tests/unilbrk/test-ulc-possible-linebreaks.c tests/unilbrk/test-ulc-width-linebreaks.c tests/uninorm/test-canonical-decomposition.c tests/uninorm/test-compat-decomposition.c tests/uninorm/test-composition.c tests/uninorm/test-decomposing-form.c tests/uninorm/test-decomposition.c tests/uninorm/test-u16-nfc.c tests/uninorm/test-u16-nfd.c tests/uninorm/test-u16-nfkc.c tests/uninorm/test-u16-nfkd.c tests/uninorm/test-u16-normcmp.c tests/uninorm/test-u16-normcoll.c tests/uninorm/test-u32-nfc.c tests/uninorm/test-u32-nfd.c tests/uninorm/test-u32-nfkc.c tests/uninorm/test-u32-nfkd.c tests/uninorm/test-u32-normalize-big.c tests/uninorm/test-u32-normcmp.c tests/uninorm/test-u32-normcoll.c tests/uninorm/test-u8-nfc.c tests/uninorm/test-u8-nfd.c tests/uninorm/test-u8-nfkc.c tests/uninorm/test-u8-nfkd.c tests/uninorm/test-u8-normcmp.c tests/uninorm/test-u8-normcoll.c tests/uninorm/test-uninorm-filter-nfc.c tests/unistdio/test-u16-asnprintf1.c tests/unistdio/test-u16-vasnprintf1.c tests/unistdio/test-u16-vasnprintf2.c tests/unistdio/test-u16-vasnprintf3.c tests/unistdio/test-u16-vasprintf1.c tests/unistdio/test-u16-vsnprintf1.c tests/unistdio/test-u16-vsprintf1.c tests/unistdio/test-u32-asnprintf1.c tests/unistdio/test-u32-vasnprintf1.c tests/unistdio/test-u32-vasnprintf2.c tests/unistdio/test-u32-vasnprintf3.c tests/unistdio/test-u32-vasprintf1.c tests/unistdio/test-u32-vsnprintf1.c tests/unistdio/test-u32-vsprintf1.c tests/unistdio/test-u8-asnprintf1.c tests/unistdio/test-u8-vasnprintf1.c tests/unistdio/test-u8-vasnprintf2.c tests/unistdio/test-u8-vasnprintf3.c tests/unistdio/test-u8-vasprintf1.c tests/unistdio/test-u8-vsnprintf1.c tests/unistdio/test-u8-vsprintf1.c tests/unistdio/test-ulc-asnprintf1.c tests/unistdio/test-ulc-vasnprintf1.c tests/unistdio/test-ulc-vasnprintf2.c tests/unistdio/test-ulc-vasnprintf3.c tests/unistdio/test-ulc-vasprintf1.c tests/unistdio/test-ulc-vsnprintf1.c tests/unistdio/test-ulc-vsprintf1.c tests/uniwbrk/test-u16-wordbreaks.c tests/uniwbrk/test-u32-wordbreaks.c tests/uniwbrk/test-u8-wordbreaks.c tests/uniwbrk/test-ulc-wordbreaks.c tests/uniwidth/test-u16-strwidth.c tests/uniwidth/test-u16-width.c tests/uniwidth/test-u32-strwidth.c tests/uniwidth/test-u32-width.c tests/uniwidth/test-u8-strwidth.c tests/uniwidth/test-u8-width.c tests/uniwidth/test-uc_width2.c tests/uniwidth/test-uc_width.c 4) Files for which the "expand" result was hand-tweaked: lib/error.h lib/glob.c lib/memcmp.c > >> perl -MText::Tabs -ni -le \ > >> '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_' > > > > How is this different from "expand -i"? Also, I would try both "expand" > > and "expand -i" and look at the differences one by one. > > It's equivalent, as far as changes induced. > > Using perl like that lets me do the update "in place" with a single > efficient command, whereas using expand -i would require a shell loop and > temporary files. Far less efficient. Well, I used 'expand' for two reasons: 1) I needed to compare the results of "expand -i" and "expand", and don't know how Perl does the second one. 2) When expanding tabs that are preceded by non-ASCII characters, we know that 'expand' uses wcwidth and therefore uses the normal width (as defined by the Unicode standard), whereas for Perl I don't know what it does. Any objections? > > Everyone who has patches on top of gnulib > > Actually it need not be disruptive. > You just need a little rigor and a trick or two What should I write in the NEWS file, about recommendations for people who have patches on top of gnulib? What are the tricks? Bruno