From 5d1ac7e93492b14b01bd66b67977e1fcf06dfa22 Mon Sep 17 00:00:00 2001 From: Adam Vogt Date: Tue, 16 Jul 2013 05:05:36 +0200 Subject: Fix issue 551 by also getting manpath without -g flag. Ignore-this: ded2d51eb7b7697c0fdfaa8158d612df Instead of taking Ondrej's approach of figuring out which man (man-db or http://primates.ximian.com/~flucifredi/man/) is used by the system, just try both sets of flags. darcs-hash:20130716030536-1499c-7e886211a39a6576b40ed277811003d17f90ef88.gz --- XMonad/Prompt/Man.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'XMonad/Prompt/Man.hs') diff --git a/XMonad/Prompt/Man.hs b/XMonad/Prompt/Man.hs index 6cdaa66..4f6cf55 100644 --- a/XMonad/Prompt/Man.hs +++ b/XMonad/Prompt/Man.hs @@ -64,11 +64,15 @@ manPrompt c = do getMans :: IO [String] getMans = do - paths <- getCommandOutput "manpath -g 2>/dev/null" `E.catch` - \(E.SomeException _) -> return [] + paths <- do + let getout cmd = getCommandOutput cmd `E.catch` \E.SomeException{} -> return "" + -- one of these combinations should give some output + p1 <- getout "manpath -g 2>/dev/null" + p2 <- getout "manpath 2>/dev/null" + return $ intercalate ":" $ lines $ p1 ++ p2 let sects = ["man" ++ show n | n <- [1..9 :: Int]] dirs = [d ++ "/" ++ s | d <- split ':' paths, s <- sects] - mans <- forM dirs $ \d -> do + mans <- forM (nub dirs) $ \d -> do exists <- doesDirectoryExist d if exists then map (stripExt . stripSuffixes [".gz", ".bz2"]) `fmap` -- cgit v1.2.3