aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Util
diff options
context:
space:
mode:
authorBrent Yorgey <byorgey@gmail.com>2007-12-17 23:29:30 +0100
committerBrent Yorgey <byorgey@gmail.com>2007-12-17 23:29:30 +0100
commit57f49d6e57adb6f20fe3f461c47dd7be02ff5fb5 (patch)
treed8c2d16d3614b62e1a00d1ce7dd501ec0a78a99a /XMonad/Util
parent4bbbcd0601ed8ed7cfcfa9b5285e1bd2164a6466 (diff)
downloadXMonadContrib-57f49d6e57adb6f20fe3f461c47dd7be02ff5fb5.tar.gz
XMonadContrib-57f49d6e57adb6f20fe3f461c47dd7be02ff5fb5.tar.xz
XMonadContrib-57f49d6e57adb6f20fe3f461c47dd7be02ff5fb5.zip
Util/Search.hs: a few updates/fixes
* fix shadowing warning (ghc 6.8.2 complains) * export a few more of the functions * re-de-obfuscate generated URLs by not escaping alphanumerics or punct. darcs-hash:20071217222930-bd4d7-6b3809c471754bb03ad6f3658f9e8c7c7d2865a2.gz
Diffstat (limited to 'XMonad/Util')
-rw-r--r--XMonad/Util/Search.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/XMonad/Util/Search.hs b/XMonad/Util/Search.hs
index c20ff1f..03e6992 100644
--- a/XMonad/Util/Search.hs
+++ b/XMonad/Util/Search.hs
@@ -17,10 +17,13 @@ module XMonad.Util.Search ( -- * Usage
-- $usage
google,
googleSelection,
+ googleSearch,
wayback,
waybackSelection,
+ waybackSearch,
wikipedia,
wikipediaSelection,
+ wikipediaSearch,
promptSearch,
search
) where
@@ -30,7 +33,7 @@ import XMonad.Util.Run (safeSpawn)
import XMonad.Prompt.Shell (getShellCompl)
import XMonad.Prompt (XPrompt(showXPrompt), mkXPrompt, XPConfig())
import XMonad.Util.XSelection (getSelection)
-import Data.Char (chr, ord)
+import Data.Char (chr, ord, isAlpha, isMark, isDigit)
import Numeric (showIntAtBase)
-- A customized prompt
@@ -42,7 +45,7 @@ instance XPrompt Search where
-- Note that everything is escaped; we could be smarter and use 'isAllowedInURI'
-- but then that'd be hard enough to copy-and-paste we'd need to depend on 'network'.
escape :: String -> String
-escape = escapeURIString (const False)
+escape = escapeURIString (\c -> isAlpha c || isDigit c || isMark c)
where
escapeURIString ::
(Char -> Bool) -- ^ a predicate which returns 'False'
@@ -59,7 +62,7 @@ escape = escapeURIString (const False)
myShowHex :: Int -> ShowS
myShowHex n r = case showIntAtBase 16 (toChrHex) n r of
[] -> "00"
- [c] -> ['0',c]
+ [ch] -> ['0',ch]
cs -> cs
toChrHex d
| d < 10 = chr (ord '0' + fromIntegral d)