[xmonad] darcs patch: Man.hs: input speedup

Valery V. Vorotyntsev valery.vv at gmail.com
Wed Dec 12 04:18:41 EST 2007


Wed Dec 12 11:02:56 EET 2007  "Valery V. Vorotyntsev" <valery.vv at gmail.com>
  * Man.hs: input speedup

  Descend manpage directories once -- when `manPrompt' is called.
  (Previous version used to search directories upon each character
  arrival.)

-- 
vvv
-------------- next part --------------

New patches:

[Man.hs: input speedup
"Valery V. Vorotyntsev" <valery.vv at gmail.com>**20071212090256
 
 Descend manpage directories once -- when `manPrompt' is called.
 (Previous version used to search directories upon each character
 arrival.)
] {
hunk ./XMonad/Prompt/Man.hs 16
---
---   * write QuickCheck properties
hunk ./XMonad/Prompt/Man.hs 59
-manPrompt c = mkXPrompt Man c manCompl $ runInTerm . (++) "man "
+manPrompt c = do
+  mans <- io getMans
+  mkXPrompt Man c (manCompl mans) $ runInTerm . (++) "man "
hunk ./XMonad/Prompt/Man.hs 63
-manCompl :: String -> IO [String]
-manCompl str | '/' `elem` str = do
-  -- XXX It may be better to use readline instead of bash's compgen...
-  lines `fmap` getCommandOutput ("bash -c 'compgen -A file " ++ str ++ "'")
-             | otherwise      = do
-  mp <- getCommandOutput "manpath -g 2>/dev/null" `E.catch` \_ -> return []
+getMans :: IO [String]
+getMans = do
+  paths <- getCommandOutput "manpath -g 2>/dev/null" `E.catch` \_ -> return []
hunk ./XMonad/Prompt/Man.hs 67
-      dirs     = [d ++ "/" ++ s | d <- split ':' mp, s <- sects]
-      stripExt = reverse . drop 1 . dropWhile (/= '.') . reverse
+      dirs     = [d ++ "/" ++ s | d <- split ':' paths, s <- sects]
hunk ./XMonad/Prompt/Man.hs 74
-  mkComplFunFromList (uniqSort $ concat mans) str
+  return $ uniqSort $ concat mans
+
+manCompl :: [String] -> String -> IO [String]
+manCompl mans s | s == "" || last s == ' ' = return []
+                | otherwise                = do
+  -- XXX readline instead of bash's compgen?
+  f <- lines `fmap` getCommandOutput ("bash -c 'compgen -A file " ++ s ++ "'")
+  mkComplFunFromList (f ++ mans) s
hunk ./XMonad/Prompt/Man.hs 85
--- XXX merge with 'XMonad.Util.Run.runProcessWithInput'?
+-- XXX Merge into 'XMonad.Util.Run'?
hunk ./XMonad/Prompt/Man.hs 87
---   * update documentation of the latter (there is no 'Maybe' in result)
---
---   * ask \"gurus\" whether @evaluate (length ...)@ approach is
---     better\/more idiomatic
+-- (Ask \"gurus\" whether @evaluate (length ...)@ approach is
+-- better\/more idiomatic.)
hunk ./XMonad/Prompt/Man.hs 99
+stripExt :: String -> String
+stripExt = reverse . drop 1 . dropWhile (/= '.') . reverse
+
}

Context:

[new XMonad.Hooks.ManageHelpers module
Lukas Mai <l.mai at web.de>**20071211183040] 
[Magnifier: custom zoom ratio for magnifier' too
intrigeri at boum.org**20071211015554] 
[Magnifier.hs: minor haddock fixes
Brent Yorgey <byorgey at gmail.com>**20071211011154] 
[fix haddock on Magnifier
tim.thelion at gmail.com**20071210231942] 
[Custom zoom levels for magnifier
tim.thelion at gmail.com**20071208230844] 
[TAG 0.5
Spencer Janssen <sjanssen at cse.unl.edu>**20071209233056] 
Patch bundle hash:
48b3abe0abeebee4f31e03ed1b65125b2c30172f


More information about the xmonad mailing list