aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
authorJurgen Doser <jurgen.doser@gmail.com>2010-03-16 13:20:10 +0100
committerJurgen Doser <jurgen.doser@gmail.com>2010-03-16 13:20:10 +0100
commitb4697ad2371e65d3b22768fa09240074c2ced06a (patch)
tree20f34bac55d64d885936460b4b654318c7e60916 /XMonad
parentb5562cfe826899153df9e91a0d24a643575875a5 (diff)
downloadXMonadContrib-b4697ad2371e65d3b22768fa09240074c2ced06a.tar.gz
XMonadContrib-b4697ad2371e65d3b22768fa09240074c2ced06a.tar.xz
XMonadContrib-b4697ad2371e65d3b22768fa09240074c2ced06a.zip
fixed argument order to isPrefixOf in a couple of places in X.A.Search
Ignore-this: 1a613748778d07de1b459a4268ff8d55 In some places, ((!>), prefixAware, and one place in the documentation), isPrefixOf was used with wrong argument order. In particular, this made combining search engines not work as advertised, for example, the predefined search engine "multi". darcs-hash:20100316122010-89868-46a01544d9e54b8630aff04bcbf131fdb65ef1f5.gz
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/Actions/Search.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/XMonad/Actions/Search.hs b/XMonad/Actions/Search.hs
index d71b892..10444d1 100644
--- a/XMonad/Actions/Search.hs
+++ b/XMonad/Actions/Search.hs
@@ -261,8 +261,8 @@ searchEngine name site = searchEngineF name (\s -> site ++ (escape s))
inside of a URL instead of in the end) you can use the alternative 'searchEngineF' function.
> searchFunc :: String -> String
-> searchFunc s | s `isPrefixOf` "wiki:" = "http://en.wikipedia.org/wiki/" ++ (escape $ tail $ snd $ break (==':') s)
-> | s `isPrefixOf` "http://" = s
+> searchFunc s | "wiki:" `isPrefixOf` s = "http://en.wikipedia.org/wiki/" ++ (escape $ tail $ snd $ break (==':') s)
+> | "http://" `isPrefixOf` s = s
> | otherwise = (use google) s
> myNewEngine = searchEngineF "mymulti" searchFunc
@@ -335,14 +335,14 @@ removeColonPrefix s = if ':' `elem` s then drop 1 $ dropWhile (':' /=) s else s
\"mathworld:integral\" will search mathworld, and everything else will fall back to
google. The use of intelligent will make sure that URLs are opened directly. -}
(!>) :: SearchEngine -> SearchEngine -> SearchEngine
-(SearchEngine name1 site1) !> (SearchEngine name2 site2) = searchEngineF (name1 ++ "/" ++ name2) (\s -> if s `isPrefixOf` (name1++":") then site1 (removeColonPrefix s) else site2 s)
+(SearchEngine name1 site1) !> (SearchEngine name2 site2) = searchEngineF (name1 ++ "/" ++ name2) (\s -> if (name1++":") `isPrefixOf` s then site1 (removeColonPrefix s) else site2 s)
{- | Makes a search engine prefix-aware. Especially useful together with '!>'.
It will automatically remove the prefix from a query so that you don\'t end
up searching for google:xmonad if google is your fallback engine and you
explicitly add the prefix. -}
prefixAware :: SearchEngine -> SearchEngine
-prefixAware (SearchEngine name site) = SearchEngine name (\s -> if s `isPrefixOf` (name++":") then site $ removeColonPrefix s else site s)
+prefixAware (SearchEngine name site) = SearchEngine name (\s -> if (name++":") `isPrefixOf` s then site $ removeColonPrefix s else site s)
{- | Changes search engine's name -}
namedEngine :: Name -> SearchEngine -> SearchEngine