On Tue, Jul 08, 2008 at 13:10:41 +1000, Trent W. Buck wrote: > I suggest patching src/Darcs/Utils.lhs to implement "view_file" on top > of get_viewer, similar to how get_editor and edit_file behave. It's > extremely sensible to try running more, then cat, if less can't be > executed -- even on Unix.
Darcs already tries does this. Please see src/Darcs/External.hs
viewDocWith :: Printers -> Doc -> IO ()
viewDocWith pr msg = do
isTerminal <- hIsTerminalDevice stdout
if isTerminal && lengthGreaterThan (20 :: Int) (lines $ renderString msg)
then do viewer <- get_viewer
pipeDocToPager viewer [] pr msg
`ortryrunning` pipeDocToPager "less" [] pr msg
`ortryrunning` pipeDocToPager "more" [] pr msg
`ortryrunning` pipeDocToPager "" [] pr msg
else pipeDocToPager "" [] pr msg
return ()
where lengthGreaterThan n _ | n <= 0 = True
lengthGreaterThan _ [] = False
lengthGreaterThan n (_:xs) = lengthGreaterThan (n-1) xs
There is a known mystery issue with darcs which causes the problem
originally reported in this thread. I'm not sure what to do about
it, although I do know that using MSYS or Cygwin makes it go away.
There was a related issue that is solved in darcs 2.0.2, where darcs
would not notice that 'less' failed to run (because it was expecting
an exit 127, which does not happen on Windows). But now it does
pick up on these failures, and so should try the alternative editors
it was always meant to try. Maybe Salvatore was referring to that
issue.
--
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
pgpa0Z3USh6rJ.pgp
Description: PGP signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
