[darcs-users] On whitespace cleanup

Gwern Branwen gwern0 at gmail.com
Wed Dec 24 03:15:43 UTC 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On Tue, Dec 23, 2008 at 7:38 PM, Trent W. Buck  wrote:
> Since Eric mentioned trailing whitespace a couple of times lately for
> incoming patches, I thought I'd generate statistics (i.e. lies) about
> the current state of the repository -- that is, current offenses against
> whitespace decency.
>
> I used the following commands, the output of which is attached.
>
>    darcs get http://darcs.net/ darcs
>    cd darcs
>    find -name _darcs -prune -o -type f -exec emacs -Q -batch {} \
>      -eval '(setq indent-tabs-mode nil)' \
>      -f universal-argument -f whitespace-cleanup -f save-buffer \;
>    darcs diff | diffstat | sort -t '|' -nk2
>
> Please note that the Emacs whitespace-cleanup function fixes more than
> just trailing whitespace.  From its documentation:
>
> | The problems cleaned up are:
> |
> | 1. empty lines at beginning of buffer.
> | 2. empty lines at end of buffer.
> |    If `whitespace-style' includes the value `empty', remove all
> |    empty lines at beginning and/or end of buffer.
> |
> | 3. 8 or more SPACEs at beginning of line.
> |    If `whitespace-style' includes the value `indentation':
> |    replace 8 or more SPACEs at beginning of line by TABs, if
> |    `indent-tabs-mode' is non-nil; otherwise, replace TABs by
> |    SPACEs.
> |
> | 4. SPACEs before TAB.
> |    If `whitespace-style' includes the value `space-before-tab':
> |    replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
> |    otherwise, replace TABs by SPACEs.
> |
> | 5. SPACEs or TABs at end of line.
> |    If `whitespace-style' includes the value `trailing', remove
> |    all SPACEs or TABs at end of line.
> |
> | 6. 8 or more SPACEs after TAB.
> |    If `whitespace-style' includes the value `space-after-tab':
> |    replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
> |    otherwise, replace TABs by SPACEs.
>
> For the record, whitespace-style had the following value when I ran it:
>
>    $ emacs -Q -batch -f whitespace-cleanup -eval '(print whitespace-style)'
>    (tabs spaces trailing lines space-before-tab newline indentation
>     empty space-after-tab space-mark tab-mark newline-mark)
>
> and of course indent-tabs-mode is nil (False) due to the first -eval.
>
>
>  190 files changed, 867 insertions(+), 993 deletions(-)
>  doc/logos/large_logo_only.png                        |binary
>  doc/logos/logo_only.png                              |binary
>  doc/logos/plain_logo.png                             |binary
>  tests/example_binary.png                             |binary
>  tests/repos/many-files--darcs-2.tgz                  |binary
>  tests/repos/many-files--hashed.tgz                   |binary
>  tests/repos/many-files--old-fashioned-inventory.tgz  |binary
>  .latex2html-init                                     |    1
>  bugs/dist-v.sh                                       |    1
>  bugs/issue1014_identical_patches.sh                  |    1
>  bugs/issue1196_whatsnew_falsely_lists_all_changes.sh |    1
>  bugs/issue944_partial_inventory.sh                   |    1
>  src/Crypt/SHA256.hs                                  |    1
>  src/Crypt/sha2.c                                     |    1
>  src/Crypt/sha2.h                                     |    1
>  src/Darcs/Commands/Dist.lhs                          |    1
>  src/Darcs/Commands/Replace.lhs                       |    1
>  src/Darcs/Commands/Revert.lhs                        |    1
>  src/Darcs/Commands/Rollback.lhs                      |    1
>  src/Darcs/Commands/SetPref.lhs                       |    1
>  src/Darcs/Commands/Show.lhs                          |    1
>  src/Darcs/Commands/Unrecord.lhs                      |    1
>  src/Darcs/Email.hs                                   |    1
>  src/Darcs/Flags.hs                                   |    1
>  src/atomic_create.h                                  |    1
>  src/building_darcs.tex                               |    1
>  src/features.tex                                     |    1
>  src/fpstring.h                                       |    1
>  src/win32/System/Posix.hs                            |    1
>  tests/add.sh                                         |    1
>  tests/addmv.sh                                       |    1
>  tests/addrace.sh                                     |    1
>  tests/addrm.sh                                       |    1
>  tests/ask_deps.sh                                    |    1
>  tests/bad-match-pattern.sh                           |    1
>  tests/conflict-fight.sh                              |    1
>  tests/illegal_mv.sh                                  |    1
>  tests/issue885_get_to_match.sh                       |    1
>  tests/justrm.sh                                      |    1
>  tests/look_for_add.sh                                |    1
>  tests/merge_three_patches.sh                         |    1
>  tests/mergeresolved.sh                               |    1
>  tests/mv-test-suite.sh                               |    1
>  tests/mv_and_remove_tests.sh                         |    1
>  tests/nonewline.sh                                   |    1
>  tests/obliterate.sh                                  |    1
>  tests/output.sh                                      |    1
>  tests/perms.sh                                       |    1
>  tests/recordrace.sh                                  |    1
>  tests/replace_after_pending_add.sh                   |    1
>  tests/replace_after_pending_mv.sh                    |    1
>  tests/repos/README                                   |    1
>  tests/revert_interactive.sh                          |    1
>  tests/rmconflict.sh                                  |    1
>  tests/sametwice.sh                                   |    1
>  tests/send_apply.sh                                  |    1
>  tests/several_commands.sh                            |    1
>  tests/show-authors.sh                                |    1
>  tests/show-bug.sh                                    |    1
>  tests/steve_and_monica_rollback.sh                   |    1
>  tests/tricky_unrecord.sh                             |    1
>  tests/uniqueoptions.sh                               |    1
>  tests/unpull-formerly-pl.sh                          |    1
>  tests/unrevert.sh                                    |    1
>  tests/what_sl.sh                                     |    1
>  tools/darcshoogle.el                                 |    1
>  tools/zsh_completion_old                             |    1
>  bugs/add_permissions.sh                              |    2
>  release/determine_release_state.pl                   |    2
>  release/openssl_ok                                   |    2
>  src/Darcs/Arguments.lhs                              |    2
>  src/Darcs/ColorPrinter.hs                            |    2
>  src/Darcs/Commands/AmendRecord.lhs                   |    2
>  src/Darcs/Commands/Check.lhs                         |    2
>  src/Darcs/Commands/Pull.lhs                          |    2
>  src/Darcs/Commands/Record.lhs                        |    2
>  src/Darcs/Commands/Remove.lhs                        |    2
>  src/Darcs/Commands/Send.lhs                          |    2
>  src/Darcs/Commands/Tag.lhs                           |    2
>  src/Darcs/Commands/WhatsNew.lhs                      |    2
>  src/Darcs/Compat.hs                                  |    2
>  src/Darcs/Patch/Info.hs                              |    2
>  src/Darcs/Patch/Non.hs                               |    2
>  src/Darcs/Patch/QuickCheck.hs                        |    2
>  src/Darcs/Patch/ReadMonads.hs                        |    2
>  src/Darcs/ProgressPatches.hs                         |    2
>  src/Darcs/RemoteApply.hs                             |    2
>  src/Darcs/Repository/Format.hs                       |    2
>  src/Darcs/Resolution.lhs                             |    2
>  src/Printer.lhs                                      |    2
>  src/RegChars.hs                                      |    2
>  src/atomic_create.c                                  |    2
>  src/c_compat.c                                       |    2
>  src/compat.h                                         |    2
>  src/darcs.tex                                        |    2
>  tests/README.test_maintainers.txt                    |    2
>  tests/conflict-fight-failure.sh                      |    2
>  tests/invalid_pending_after_mv_to_self.sh            |    2
>  tests/issue612_repo_not_writeable.sh                 |    2
>  tests/issue844_gzip_crc.sh                           |    2
>  tests/mv-formerly-pl.sh                              |    2
>  tests/shell_harness.hs                               |    2
>  tools/cgi/cgi.conf.in                                |    2
>  tools/cgi/xslt/repos.xslt                            |    2
>  tools/darcshoogle                                    |    2
>  release/darcs.nsi                                    |    3
>  src/Darcs/ArgumentDefaults.lhs                       |    3
>  src/Darcs/Commands/Add.lhs                           |    3
>  src/Darcs/Commands/Diff.lhs                          |    3
>  src/Darcs/Commands/Init.lhs                          |    3
>  src/Darcs/Patch.lhs                                  |    3
>  src/Darcs/Patch/Apply.lhs                            |    3
>  src/Darcs/Repository/DarcsRepo.lhs                   |    3
>  src/DateMatcher.hs                                   |    3
>  src/win32/CtrlC.hs                                   |    3
>  src/win32/sys/mman.h                                 |    3
>  tests/mv_then_add.sh                                 |    3
>  tests/optimize_relink.sh                             |    3
>  Distribution/ShellHarness.hs                         |    4
>  doc/darcs.css                                        |    4
>  release/darcs.spec.in                                |    4
>  src/ByteStringUtils.hs                               |    4
>  src/Darcs/Commands/Annotate.lhs                      |    4
>  src/Darcs/Commands/Apply.lhs                         |    4
>  src/Darcs/Commands/Convert.lhs                       |    4
>  src/Darcs/Commands/Put.lhs                           |    4
>  src/Darcs/Lock.hs                                    |    4
>  src/Darcs/Patch/Commute.lhs                          |    4
>  src/Darcs/Patch/Real.hs                              |    4
>  src/Darcs/Repository/HashedRepo.hs                   |    4
>  src/Darcs/Repository/Pristine.hs                     |    4
>  src/gpl.tex                                          |    4
>  src/unit.lhs                                         |    4
>  src/win32/System/Posix/IO.hsc                        |    4
>  tests/checkpoint.sh                                  |    4
>  tests/ssh.sh                                         |    4
>  tests/unrevert_cancel.sh                             |    4
>  src/Darcs/Repository/Prefs.lhs                       |    5
>  src/switching.tex                                    |    5
>  darcs.cabal                                          |    6
>  doc/index.html.in                                    |    6
>  src/Darcs/CheckFileSystem.hs                         |    6
>  src/Darcs/Commands/Mv.lhs                            |    6
>  src/Darcs/Repository/Repair.hs                       |    6
>  src/win32/System/Posix/Files.hsc                     |    6
>  tests/issue538.sh                                    |    6
>  tests/partial.sh                                     |    6
>  tools/cgi/xslt/styles.css                            |    6
>  tests/hashed_inventory.sh                            |    7
>  doc/misc/api-doc-frames.html                         |    8
>  doc/misc/hoogle-small.html                           |    8
>  src/CommandLine.hs                                   |    8
>  src/Darcs/Patch/Prim.lhs                             |    8
>  src/Darcs/Repository.hs                              |    8
>  src/Darcs/Repository/Internal.hs                     |    8
>  src/Darcs/SlurpDirectory/Internal.hs                 |    8
>  src/Lcs.hs                                           |    8
>  src/fpstring.c                                       |    8
>  tests/get_tag.sh                                     |    8
>  tests/query_manifest.sh                              |    8
>  tools/cgi/xslt/patches.xslt                          |    8
>  src/Darcs/Commands/Help.lhs                          |    9
>  src/win32/send_email.h                               |    9
>  configure.ac                                         |   10
>  src/Darcs/Utils.hs                                   |   10
>  src/formats.tex                                      |   10
>  tools/cgi/xslt/browse.xslt                           |   10
>  src/Darcs/Commands/Optimize.lhs                      |   12
>  src/Darcs/Diff.hs                                    |   12
>  tools/cgi/xslt/common.xslt                           |   12
>  COPYING                                              |   14
>  COPYING.LIB                                          |   14
>  tools/cygwin-wrapper.bash                            |   15
>  hpc.README                                           |   16
>  src/configuring_darcs.tex                            |   16
>  Setup.lhs                                            |   18
>  src/Darcs/Patch/Depends.hs                           |   18
>  tools/update_roundup.pl                              |   22 -
>  src/win32/send_email.c                               |   23 -
>  src/list_authors.hs                                  |   25 -
>  tools/cgi/darcs.cgi.in                               |   37 -
>  tools/darcs_completion                               |   41 -
>  src/OldDate.hs                                       |   50 +-
>  tools/cgi/xslt/annotate.xslt                         |   56 +-
>  autoconf.mk.in                                       |   62 +-
>  install-sh                                           |   80 +--
>  src/IsoDate.hs                                       |   88 ++--
>  src/best_practices.tex                               |  153 +++----
>  tools/zsh_completion_new                             |  188 ++++----
>  GNUmakefile                                          |  412 +++++++++----------

Interesting stuff, but I immediately am struck by concern - is that
command safe to use on GNUmakefile? I remember makefiles being finicky
about whitespace.

- --
gwern
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEAREKAAYFAklRqVMACgkQvpDo5Pfl1oKI/gCgisalx5ddICffISi9RLDuKYal
4QYAn3Lhf+Hp5sZGuRSRYpAeoyoz1Jj2
=naly
-----END PGP SIGNATURE-----


More information about the darcs-users mailing list