Issue 393 in xmonad: XMonad.Prompt.Shell should use user-defined searchPredicate

Status: New Owner: ---- New issue 393 by hgabreu: XMonad.Prompt.Shell should use user-defined searchPredicate http://code.google.com/p/xmonad/issues/detail?id=393 What steps will reproduce the problem? 1. Set-up XMonad.Prompt.Shell with defaulXPConfig changing the searchPredicate to something else. e.g. \x y -> map toLower x `isPrefixOf` map toLower y 2. run your prompt, start typing anything to see that your searchPredicate is ignored. In the above example case IS ignored, so typing 'VI' should show 'vi' or 'vim' on the list, but they're not. What version of the product are you using? On what operating system? latest darcs on up-to-date Archlinux x86_64 Are you using an xmonad.hs? Please attach it and the output of "xmonad --recompile". recompile prints nothing and my cluttered xmonad.hs is attached but only line 166 is related (which is a keybind to X.A.SpawnOn shellPromptHere). Please provide any additional information below. X.P.Shell also completes filenames using bash's compgen, it should respect user's setting (~/.inputrc) telling it to ignore-case (set completion- ignore-case on). But that's another problem, I'm just complaining about command completion for now. Attachments: xmonad.hs 16.3 KB -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings

Comment #1 on issue 393 by hgabreu: XMonad.Prompt.Shell should use user-defined searchPredicate http://code.google.com/p/xmonad/issues/detail?id=393 I've managed to set up Shell the way I wanted, which is ignoring case. It may help anyone willing to correct/enhance XMonad.Prompt.Shell, I don't do it myself because I'm very bad at haskell and don't how to do it right, flexible, etc. I copied X.P.Shell getShellCompl and commandCompletionFunction to my config (attached) and changed them to this: getShellCompl cmds s | s == "" || last s == ' ' = return [] | otherwise = do f <- fmap lines $ runProcessWithInput "bash" [] ("bind 'set completion- ignore-case on'; compgen -A file " ++ encodeOutput s ++ "\n") ...the rest of the function is the same... commandCompletionFunction cmds str | '/' `elem` str = [] | otherwise = filter ((\x y -> map toLower x `isPrefixOf` map toLower y) str) cmds Oh! I don't think anyone will ever try this config as is, but is one does, change the layoutHook because it won't run ok. I edited MouseResizableTile here to play with SubLayouts. Attachments: xmonad.hs 17.3 KB -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings

Comment #2 on issue 393 by dunric...@gmail.com: XMonad.Prompt.Shell should use user-defined searchPredicate http://code.google.com/p/xmonad/issues/detail?id=393 Hi, I just fixed (at least for me) the issue shellPrompt ignores searchPredicate field of XPConfig record. After applying my patch, you can now create/combine whatever function you want and it will by used at filtering of shell commands completion. Just set searchPredicate field and pass it to shellPrompt. Of my xmonad.hs config: import qualified Data.List as L import Data.Char ... , ((myModMask, xK_x), shellPrompt defaultXPConfig { -- match a substring anywhere within and ignore case searchPredicate = L.isInfixOf . (map toLower) ... } Patch created for xmonad-contrib ver. 0.10 Take care :-) Attachments: shell-compl_predicate.patch 4.4 KB

Updates: Status: Patch Comment #3 on issue 393 by gwe...@gmail.com: XMonad.Prompt.Shell should use user-defined searchPredicate http://code.google.com/p/xmonad/issues/detail?id=393 Anyone have any thoughts? The only type/API change is to 'getShellCompl', which is not used in any of the configs in my archive (one config hides it and redefines it).

Comment #4 on issue 393 by dan...@schoepe.org: XMonad.Prompt.Shell should use user-defined searchPredicate http://code.google.com/p/xmonad/issues/detail?id=393 Looks good to me.

Comment #5 on issue 393 by dunric...@gmail.com: XMonad.Prompt.Shell should use user-defined searchPredicate http://code.google.com/p/xmonad/issues/detail?id=393 Hi, me again. As a search predicate for shellPrompt is still not implemented in an upstream, here is the updated patch to xmonad-contrib 0.11 sources. In addition to the previous version it sorts list of the possible commands not only alphabetically but also favours commands starting with the same sequence as typed in prompt. Similar behaviour seen at dmenu launcher. For example my search predicate for XMonad.Prompt.Shell.shellPrompt matches anywhere inside of possible command names, not only at their begining and ignoring case at the same time: searchPredicate = L.isInfixOf . map toLower Now when trying to launch a firefox browser and type "fire" at xmonad's shellPrompt I'm getting the following completions in that order: firefox aafire cacafire Attachments: shell-compl_predicate.patch 5.1 KB
participants (1)
-
codesite-noreply@google.com