[xmonad] How to disable history in XMonad.Actions.Search.

Mike Sampson mike at sambodata.com
Sun Sep 20 17:49:52 EDT 2009


On Mon, Sep 21, 2009 at 3:56 AM, Gwern Branwen <gwern0 at gmail.com> wrote:
>
> This patch isn't perfect, though. I reflected on it and realized that
> it doesn't make sense to have invokers of mkXPrompt do the filtering
> themselves, when mkXPrompt has access to the XPConfig and the
> Completion functions - one could just write the filtering once, in
> mkXPrompt, and not every caller.
>
> But when I went to add it, I saw that mkXPrompt wraps
> mkXPromptWithReturn, and the latter calls 'historyFilter conf'! Which
> mystifies me. I'm now not sure why my patch worked or what to do next:

As I mentioned my Haskell skills are quite limited but from what I
understand this functionality should have been working as is? Anything
using MkXPrompt should honour the historyFilter field. If that is so
perhaps the real question is why wasn't it working to begin with?

I will try reverting your patch, rebuilding and double check that the
historyFilter field of XPConfig is in fact ignored. I hope I haven't
missed a step here or something and led you on a wild goose chase. I
will try this after work and report back.

> mkXPromptWithReturn ∷  XPrompt p ⇒  p →  XPConfig →  ComplFunction →
> (String →  X a)  →  X (Maybe a)
> mkXPromptWithReturn t conf compl action = do
>  c ←  ask
>  let d = display c
>      rw = theRoot c
>  s ←  gets $ screenRect · W.screenDetail · W.current · windowset
>  hist ←  liftIO $ readHistory
>  w ←  liftIO $ createWin d rw conf s
>  liftIO $ selectInput d w $ exposureMask .|. keyPressMask
>  gc ←  liftIO $ createGC d w
>  liftIO $ setGraphicsExposures d gc False
>  fs ←  initXMF (font conf)
>  let hs = fromMaybe [] $ Map.lookup (showXPrompt t) hist
>      st = initState d rw w s compl gc fs (XPT t) hs conf
>  st' ←  liftIO $ execStateT runXP st
>
>  releaseXMF fs
>  liftIO $ freeGC d gc
>  if successful st'
>    then do
>      liftIO $ writeHistory $ Map.insertWith
>                                (λxs ys →  take (historySize conf)
>                                        · historyFilter conf $ xs ++ ys)
>                                (showXPrompt t) [command st'] hist
>      Just <$> action (command st')
>    else return Nothing
>
> --
> gwern
>


More information about the xmonad mailing list