Essentially, whenever the tutorial actually has decent material on the
subject matter. The replacement is roughly done as follows:
- logHook → tutorial
- keybindings → tutorial, as this is thoroughly covered
- manageHook → tutorial + X.D.Extending, as the manageHook stuff the
tutorial talks about is a little bit of an afterthought.
- X.D.Extending (on its own) → tutorial + X.D.Extending
- layoutHook → tutorial + X.D.Extending, as the tutorial, while
talking about layouts, doesn't necessarily have a huge focus there.
- mouse bindings → leave this alone, as the tutorial does not at all
talk about them.
This is a convenience module in order to have less import noise. It
re-exports the following:
a) Commonly used modules in full (Data.Foldable, Data.Applicative, and
so on); though only those that play nicely with each other, so that
XMonad.Prelude can be imported unqualified without any problems.
This prevents things like `Prelude.(.)` and `Control.Category.(.)`
fighting with each other.
b) Helper functions that don't necessarily fit in any other module;
e.g., the often used abbreviation `fi = fromIntegral`.
A new prompt that works like 'safePrompt', but is optimized for the
use-case of a program that needs a file as an argument.
This is necessarily a new function and can't just be achieved by using
the old `safePrompt`, as `getShellCompl'` does not at all filter the
files (compgen already does that based on the input), but only the
available commands. If we start the prompt with a single command then
the chosen `searchPredicate` becomes quite useless and we can't take
advantage of fuzzy matching for file finding. This, however, is quite
useful when having a program that explicitly expects a file as one of
its arguments, e.g. dragon [1].
What we have to do instead of to generate all available files with
compgen and _then_ filter this down to what we want via a given
function. In order to make this change backwards compatible we have to
introduce the rather ugly `shellComplImpl`, which takes a laundry list
of all of the different parameters that we need. Since the function is
not exported, this ugliness does perhaps not matter too much.
[1]: https://github.com/mwh/dragon
Provide a way to perform case-insensitive file / directory completion.
We're using compgen to generate completion candidates, and this is
case-sensitive by default. We can control this by setting the
completion-ignore-case Readline variable prior to invoking compgen. If
we're running a Bash with Readline support, this works as expected.
Otherwise, it has no effect -- completion candidates are still returned,
but compgen generates them in a case-sensitive manner.
To avoid breaking changes, the signatures and behavior of existing
exported functions are unchanged:
- XMonad.Layout.WorkspaceDir.changeDir
- XMonad.Prompt.Directory.directoryPrompt
- XMonad.Prompt.Shell.getShellCompl
New variations of these functions are provided, allowing the caller
to specify the desired case-sensitivity via a ComplCaseSensitivity
argument:
- XMonad.Layout.WorkspaceDir.changeDir'
- XMonad.Prompt.Directory.directoryPrompt'
- XMonad.Prompt.Shell.getShellCompl'
The XMonad.Prompt.Shell exports a couple new functions:
- compgenDirectories
- compgenFiles
We make use of this in XMonad.Prompt.Directory to avoid duplicating the
compgen code.
The following change from 2013-02-09 breaks shell completion for me:
hunk ./XMonad/Prompt/Shell.hs 65
+ commandToComplete _ c = c
It seems to be passing the entire string into compgen in order to get the file completions, but it should only pass the last word. I propose reverting this change. Comments are appreciated.
The base that comes with ghc-7.6.1 no longer includes Prelude.catch;
so these modules were changed so that there is no warning for
import Prelude hiding (catch)
At the same time these changes should be compatible with older GHCs,
since the catch being has never been the one in the Prelude.
Now that spawn assumes executeFile takes a String containing utf8 codepoints
(and takes an actual String as input) adjust Prompt.Shell to avoid double
encoding. U.Run functions are updated to be consistent with spawn.
* true error: more modules export foldl/foldl'/foldr, so explicitly use the Data.Foldable one
* -Werror error: transition from Control.OldException to Control.Exception, assuming everything was IOException
doesDirectoryExist returns True if given an empty string using ghc <= 6.10.4.
This causes getDirectoryContents to raise an exception and X.P.Shell does not
render. This is only an issue if you have an empty string in your PATH.
Using ghc == 6.12.1, doesDirectoryExist returns False given an empty string, so
this should not be an issue in the future.
The helper function asks the shell for the value of a variable, else returns the second argument.
getBrowser and getEditor obviously specialize it for two particular possibly queries