diff options
author | Spencer Janssen <spencerjanssen@gmail.com> | 2008-09-21 11:34:53 +0200 |
---|---|---|
committer | Spencer Janssen <spencerjanssen@gmail.com> | 2008-09-21 11:34:53 +0200 |
commit | b5f484cc7e943509fd0ebddb83d4ca988ecb1f58 (patch) | |
tree | cc8ac0cad744f63925f676dc2cec904bd4c83a14 /XMonad | |
parent | 3625434520827b6f0ee549856f5f6511c029aec5 (diff) | |
download | XMonadContrib-b5f484cc7e943509fd0ebddb83d4ca988ecb1f58.tar.gz XMonadContrib-b5f484cc7e943509fd0ebddb83d4ca988ecb1f58.tar.xz XMonadContrib-b5f484cc7e943509fd0ebddb83d4ca988ecb1f58.zip |
Prompt: add configurable history filters
darcs-hash:20080921093453-25a6b-131438cecc65038c592e99e60b98c878d39e01cd.gz
Diffstat (limited to 'XMonad')
-rw-r--r-- | XMonad/Prompt.hs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/XMonad/Prompt.hs b/XMonad/Prompt.hs index 0e54a4b..acea7bb 100644 --- a/XMonad/Prompt.hs +++ b/XMonad/Prompt.hs @@ -44,6 +44,9 @@ module XMonad.Prompt , decodeInput , encodeOutput , historyCompletion + -- * History filters + , deleteAllDuplicates + , deleteConsecutiveDuplicates ) where import Prelude hiding (catch) @@ -109,11 +112,14 @@ data XPConfig = , position :: XPPosition -- ^ Position: 'Top' or 'Bottom' , height :: !Dimension -- ^ Window height , historySize :: !Int -- ^ The number of history entries to be saved + , historyFilter :: [String] -> [String] + -- ^ a filter to determine which + -- history entries to remember , defaultText :: String -- ^ The text by default in the prompt line , autoComplete :: Maybe Int -- ^ Just x: if only one completion remains, auto-select it, , showCompletionOnTab :: Bool -- ^ Only show list of completions when Tab was pressed -- and delay by x microseconds - } deriving (Show, Read) + } data XPType = forall p . XPrompt p => XPT p @@ -180,6 +186,7 @@ defaultXPConfig = , position = Bottom , height = 18 , historySize = 256 + , historyFilter = id , defaultText = [] , autoComplete = Nothing , showCompletionOnTab = False @@ -808,3 +815,11 @@ uniqSort = toList . fromList -- from the query history stored in ~/.xmonad/history. historyCompletion :: ComplFunction historyCompletion x = fmap (filter (isInfixOf x) . Map.fold (++) []) readHistory + +-- | Functions to be used with the 'historyFilter' setting. +-- 'deleteAllDuplicates' will remove all duplicate entries. +-- 'deleteConsecutiveDuplicates' will remove duplicate elements which are +-- immediately next to each other. +deleteAllDuplicates, deleteConsecutiveDuplicates :: [String] -> [String] +deleteAllDuplicates = nub +deleteConsecutiveDuplicates = map head . group |