I tried a new approach today: ask hlint what functions *it* doesn't
like, then ignore its advice and try to completely rewrite the
function from scratch.  Hopefully this produces more useful results.

The third patch in this bundle demonstrates the idea I just had: to
include the relevant manual subsection in _darcs/prefs/*.  It's
bedtime, so I haven't actually run that third patch through preproc.hs
(i.e. "make html") to see what happens yet, which is why it's marked
as DRAFT.  I'm sending it now so people can start complaining in
advance ;-)

Sat Jan 17 23:54:59 EST 2009  Trent W. Buck <[email protected]>
  * Refactor actual_boring_file_filter.

Sun Jan 18 00:59:06 EST 2009  Trent W. Buck <[email protected]>
  * Refactor darcs_binaries.
  
  Instead of creating a very long list of simple regexps, this now
  creates two regexps of the form \.(a|b|...|z)$, the latter being
  uppercase.  I have also combined some extension variants (e.g. .jpe?g
  instead of two entries .jpg and .jpeg) and sorted the extension list.
  
  I've elected NOT to use Emacs' regexp-opt to build a faster regexp,
  because that would make it very hard for end users to find and remove
  an extension from the default list.  I think merging .jpe?g is OK.

Sun Jan 18 01:04:01 EST 2009  Trent W. Buck <[email protected]>
  * DRAFT: rewrite docs in _darcs/prefs/binaries.

New patches:

[Refactor actual_boring_file_filter.
Trent W. Buck <[email protected]>**20090117125459
 Ignore-this: 1462405da94988c0323fc47e4450c01d
] hunk ./src/Darcs/Repository/Prefs.lhs 40
 import Control.Monad ( unless, when, mplus )
 import Text.Regex ( Regex, mkRegex, matchRegex, )
 import Data.Char ( toUpper )
-import Data.Maybe ( isNothing, isJust, catMaybes )
+import Data.Maybe ( isJust, catMaybes )
 import Data.List ( nub, isPrefixOf )
 import System.Directory ( getAppUserDataDirectory, doesDirectoryExist )
 import System.Environment( getEnv )
hunk ./src/Darcs/Repository/Prefs.lhs 286
           nc l | startswith "^ ^ ^ ^ ^ ^ ^" l = False
           nc _ = True
 
+-- | From a list of paths, filter out any that are within @_darcs@ or
+-- match a boring regexp.
 actual_boring_file_filter :: [Regex] -> [FilePath] -> [FilePath]
hunk ./src/Darcs/Repository/Prefs.lhs 289
-actual_boring_file_filter regexps fs =
-    filter (abf (not.is_darcsdir) regexps . normalize) fs
-    where
-    abf fi (r:rs) = abf (\f -> fi f && isNothing (matchRegex r f)) rs
-    abf fi [] = fi
+actual_boring_file_filter regexps files = filter (not . boring) files
+    where boring file = is_darcsdir file ||
+                        any (\regexp -> isJust $ matchRegex regexp file) regexps
 
 normalize :: FilePath -> FilePath
 normalize ('.':'/':f) = normalize f
[Refactor darcs_binaries.
Trent W. Buck <[email protected]>**20090117135906
 Ignore-this: 76174e648ec72ace6f26e6372a4e816
 
 Instead of creating a very long list of simple regexps, this now
 creates two regexps of the form \.(a|b|...|z)$, the latter being
 uppercase.  I have also combined some extension variants (e.g. .jpe?g
 instead of two entries .jpg and .jpeg) and sorted the extension list.
 
 I've elected NOT to use Emacs' regexp-opt to build a faster regexp,
 because that would make it very hard for end users to find and remove
 an extension from the default list.  I think merging .jpe?g is OK.
] hunk ./src/Darcs/Repository/Prefs.lhs 41
 import Text.Regex ( Regex, mkRegex, matchRegex, )
 import Data.Char ( toUpper )
 import Data.Maybe ( isJust, catMaybes )
-import Data.List ( nub, isPrefixOf )
+import Data.List ( nub, isPrefixOf, intersperse )
 import System.Directory ( getAppUserDataDirectory, doesDirectoryExist )
 import System.Environment( getEnv )
 import System.FilePath ( (</>) )
hunk ./src/Darcs/Repository/Prefs.lhs 319
                 deriving (Eq)
 
 {-# NOINLINE default_binaries #-}
+-- | The lines that will be inserted into @_darcs/prefs/binaries@ when
+-- @darcs init@ is run.  Hence, a list of comments, blank lines and
+-- regular expressions (ERE dialect).
+--
+-- Note that while this matches .gz and .GZ, it will not match .gZ,
+-- i.e. it is not truly case insensitive.
 default_binaries :: [String]
hunk ./src/Darcs/Repository/Prefs.lhs 326
-default_binaries =
-    "# Binary file regexps:" :
-    ext_regexes ["png","gz","pdf","jpg","jpeg","gif","tif",
-                 "tiff","pnm","pbm","pgm","ppm","bmp","mng",
-                 "tar","bz2","z","zip","jar","so","a",
-                 "tgz","mpg","mpeg","iso","exe","doc",
-                 "elc", "pyc"]
-    where ext_regexes exts = concat $ map ext_regex exts
-          ext_regex e = ["\\."++e++"$", "\\."++map toUpper e++"$"]
+default_binaries = ["# Binary file regexps:", regexp, map toUpper regexp]
+    where regexp = "\\.(" ++ concat (intersperse "|" extensions) ++ ")$"
+          extensions = ["a","bmp","bz2","doc","elc","exe","gif","gz","iso",
+                        "jar","jpe?g","mng","mpe?g","p[nbgp]m","pdf","png",
+                        "pyc","so","tar","tgz","tiff?","z","zip"]
 
 filetype_function :: IO (FilePath -> FileType)
 filetype_function = do
[DRAFT: rewrite docs in _darcs/prefs/binaries.
Trent W. Buck <[email protected]>**20090117140401
 Ignore-this: d68a79c987410313490f6ed7deca4594
] hunk ./src/Darcs/Repository/Prefs.lhs 302
 \end{code}
 
 \paragraph{binaries}
-The \verb!_darcs/prefs/binaries! file may contain a list of regular
-expressions describing files that should be treated as binary files rather
-than text files. Darcs automatically treats files containing
+\haskell{binaries_file_help}
+
+Darcs automatically treats files containing
 \verb!^Z\! or \verb!'\0'! within the first 4096 bytes as being binary files.
 You probably will want to have the binaries file under
 version control.  To do this you can use darcs setpref to set the value
hunk ./src/Darcs/Repository/Prefs.lhs 326
 -- Note that while this matches .gz and .GZ, it will not match .gZ,
 -- i.e. it is not truly case insensitive.
 default_binaries :: [String]
-default_binaries = ["# Binary file regexps:", regexp, map toUpper regexp]
+default_binaries = [help, regexp, map toUpper regexp]
     where regexp = "\\.(" ++ concat (intersperse "|" extensions) ++ ")$"
           extensions = ["a","bmp","bz2","doc","elc","exe","gif","gz","iso",
                         "jar","jpe?g","mng","mpe?g","p[nbgp]m","pdf","png",
hunk ./src/Darcs/Repository/Prefs.lhs 331
                         "pyc","so","tar","tgz","tiff?","z","zip"]
+          help = unlines $ map ("# "++) $ lines binaries_file_help
+
+-- | This documentation is inserted into both the user manual and into
+-- the @binaries@ file itself.
+binaries_file_help :: String
+binaries_file_help = unlines $  -- because \haskell{} demands String :-(
+  ["This file contains a list of extended regular expressions, one per",
+   "line.  A file path matching any of these expressions is assumed to",
+   "contain binary data (not text).  Then entries in ~/.darcs/binaries (if",
+   "it exists) supplement those in this file.",
+   "",
+   "Blank lines, and lines beginning with an octothorpe (#) are ignored.",
+   "See regex(7) for a description of extended regular expressions."]
 
 filetype_function :: IO (FilePath -> FileType)
 filetype_function = do

Context:

[Refactor: use more guards.
Trent W. Buck <[email protected]>**20090115072617
 Ignore-this: b41bb970198ed1f42aebdfc63c90e115
] 
[Resolve issue1311:  Use time zones from GNU coreutils; improve doc.
Dave Love <[email protected]>**20090112135012
 Ignore-this: 883bc4ccdb1d27fde14ec9c76a4d2a45
] 
[omit empty line at the end of output in darcs diff
Christian Kellermann <[email protected]>**20090114110607
 Ignore-this: d71a3d5460fbe21244c4eba77dc47885
] 
[Clean up when previous test crashed.
Trent W. Buck <[email protected]>**20090113001345] 
[Make "make clean" remove microbench.
Trent W. Buck <[email protected]>**20090111152130
 Put the clean target directly below the build target, so it's harder
 to get them out of sync in future.
] 
[Fix test optimize_relink.sh when no hard linking available
Thorkil Naur <[email protected]>**20090113223335
 The semicolon in the echo command causes the test to fail with the
 message
 
 > optimize_relink.sh: line 37: assuming: command not found
 
 when no hard linking is available.
] 
[Consistently use sh (not csh) prompts in user manual.
Trent W. Buck <[email protected]>**20090111114801
 
 The sh prompt ($) was already used elsewhere in the manual, and I
 choose to standardize on it instead of csh (%) because sh (especially
 bash) seems more widespread and recognizable as the user shell prompt.
] 
[resolve issue1270: don't show the motd when --xml-output is given
[email protected]**20090109090726
 Ignore-this: e1dae49ceb510668a1358e2103268cc3
] 
[Get setpref description in manual.
Dave Love <[email protected]>**20090111151941
 Ignore-this: 89b0d00a82582d03fdf51cd9822dba65
] 
[Example for issue1284.
Trent W. Buck <[email protected]>**20090111051101] 
[resolve issue1235: added --summary to obliterate
Rob Hoelz <[email protected]>**20090110032907] 
[Haddock for Darcs.Repository.Format
Florent Becker <[email protected]>**20090108160035
 Ignore-this: f88f0223ebbbe5694845dd1060e6f978
] 
[Remove stale comment (we now require GHC 6.6)
Eric Kow <[email protected]>**20081231080929
 Ignore-this: b19da9fabc8d2e38bccafc84a77fa278
] 
[do not use concatenation in src/Context.hs
Florent Becker <[email protected]>**20090107135552
 Ignore-this: 9e86505a445730b7653e75f08e8ff81e
] 
[Print malicious paths and optional way around them when they cause a failure.
David Caldwell <[email protected]>**20090105101628
 Ignore-this: cdb706087869e19e046bc0dd424ca38d
] 
[Fix typo in --dont-restrict-paths documentation.
David Caldwell <[email protected]>**20090105024208
 Ignore-this: 16197eeef34dedddeda036b47747f234
] 
[Add --restrict-paths (and --dont-restrict-paths) to "darcs apply".
David Caldwell <[email protected]>**20090102101737
 Ignore-this: f6ab937573bf0d5397361ddefed902c9
] 
[Add --restrict-paths (and --dont-restrict-paths) to "darcs pull".
David Caldwell <[email protected]>**20090102101726
 Ignore-this: dd3bc04632d341be16709e0aee6753ec
] 
[Revert --restrict-paths removal.
David Caldwell <[email protected]>**20090102101705
 Ignore-this: 1fba1f9a589aaabb1fa27a268f7c972e
] 
[Resolve issue1302: set closed bugs to resolved (not resolved-in-unstable).
Trent W. Buck <[email protected]>**20090105001351] 
[make stringify cut the string
[email protected]**20090104102125
 Ignore-this: e1a0cd83fce5085f60b812d894ca26e7
 This avoids choking utilities such as grep (or emacs' internal grep) which parse haskell files line-by-line.
] 
[make unit's return value depend on all tests
Florent Becker <[email protected]>**20090102184930
 Ignore-this: fce3636c70bcb4a80413823c88e3ac6a
] 
[Resolve issue1285: remove "cabal test" intermediaries.
Trent W. Buck <[email protected]>**20090103095347] 
[Resolve issue1206: Countable Nouns.
Trent W. Buck <[email protected]>**20090101062452
 Use the conventional term "Countable" instead of "Numbered".
] 
[Improve readability of bug reporting.
Trent W. Buck <[email protected]>**20081226120833
 Moving "at <location>" to the first line gives the descriptive string
 a line all to itself.  For example, darcs show bug:
 
     darcs: bug at src/Darcs/Commands/ShowBug.lhs:57 compiled Nov  4 2008 12:05:43
     This is actually a fake bug in darcs.
] 
[Use imperative mood for primitive matcher help.
Trent W. Buck <[email protected]>**20081228114434] 
[Check GADT witnesses when doing Cabal-based builds.
Petr Rockai <[email protected]>**20081228111229] 
[Fix haddock error
Eric Kow <[email protected]>**20081227204218
 Ignore-this: 60f05d20e5f37312f6b477067114fac7
] 
[Haddock for primitiveMatchers (untested).
Trent W. Buck <[email protected]>**20081227141921] 
[Rewrite primitive matcher examples.
Trent W. Buck <[email protected]>**20081227141845] 
[Rewrite "darcs help --match" output.
Trent W. Buck <[email protected]>**20081227141819
 Add an introductory paragraph, and put all the examples into a single
 code block, since one-line paragraphs are kind hard to read.
] 
[Delete superfluous "Introduction" headings.
Trent W. Buck <[email protected]>**20081227034129
 I don't think it's useful to grant a subsection heading to the single
 introductory paragraph of a section.
] 
[Refactor error text for readability.
Trent W. Buck <[email protected]>**20081109144007] 
[Tweak user manual's title page.
Trent W. Buck <[email protected]>**20081227011031
 It annoyed me that the user manual was just called "Darcs", not "Darcs
 User Manual".
] 
[Improve readability of bug reporting.
Trent W. Buck <[email protected]>**20081226104243
 Moving "at <location>" to the first line gives the descriptive string
 a line all to itself.  For example, darcs show bug:
 
     darcs: bug at src/Darcs/Commands/ShowBug.lhs:57 compiled Nov  4 2008 12:05:43
     This is actually a fake bug in darcs.
] 
[Haddockize developer comment.
Trent W. Buck <[email protected]>**20081214041902] 
[Darcs.ColorPrinter: factor out getPolicy call
[email protected]**20081222180227
 Ignore-this: aee5b5415ee8bbfe1dac06e240b90080
 Less redundancy. 'getPolicy' is being called with the same args, and it's
 not like the environmental variables are going to change in between each
 call.
] 
[Make it possible to run just specific tests from cabal commandline.
Petr Rockai <[email protected]>**20081223083742
 
 All of `cabal test repair-corrupt bugs/newlines bugs/issue27.sh` should work as
 expected. The implementation is not very efficient, but seems to work fine.
] 
[Neatify "cabal test" option munging in Setup.lhs.
Petr Rockai <[email protected]>**20081223080811] 
[Sort the list of tests that are run by cabal.
Petr Rockai <[email protected]>**20081223073642] 
[Remove now-unused replacePristine.
Petr Rockai <[email protected]>**20081210065138] 
[resolve issue948: rewrite darcsman.
Trent W. Buck <[email protected]>**20081221081934
 
 Significant changes are:
 
  - Avoid duplicating groups from TheCommands.
  - Due to growing command_helps, list commands in SYNOPSIS.
  - Use subsections (.SS) for groups.
  - Include (with fancy markup!) command arguments.
  - Include darcs help --match.
  - Copy-and-paste description from darcs.cabal.
  - Remove AUTHORS section as suggested by man-pages(7).
  - Declare my copyright.
 
] 
[Tweak punctuation in "darcs help --match".
Trent W. Buck <[email protected]>**20081221080949
 
 Manpages treat apostrophes in the first line specially.  Use `TeX
 style' quotes instead, so this string can be included in the manpage.
 
 Also omit mention of &&, || and ! until I find time to clarify that
 they are aliases for the human-readable and, or and not.
] 
[TAG 2.2.0
Petr Rockai <[email protected]>**20090115150916] 
Patch bundle hash:
df63a3144374597848668afca40f69652503a531
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to