diff options
author | Fraser Tweedale <frase@frase.id.au> | 2019-04-10 21:53:08 +1000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-04-15 06:26:37 -0400 |
commit | 71cf94db8445e5d8225ce65a9feecbfaa3ac3fe3 (patch) | |
tree | b5d60858c3639a439da3bfb4b21dc328988f4f19 /ghc/GHCi/UI/Monad.hs | |
parent | 4b1ef06d45fb3cd226b5ec4217e975d48b85e645 (diff) | |
download | haskell-71cf94db8445e5d8225ce65a9feecbfaa3ac3fe3.tar.gz |
GHCi: fix load order of .ghci files
Directives in .ghci files in the current directory ("local .ghci")
can be overridden by global files. Change the order in which the
configs are loaded: global and $HOME/.ghci first, then local.
Also introduce a new field to GHCiState to control whether local
.ghci gets sourced or ignored. This commit does not add a way to
set this value (a subsequent commit will add this), but the .ghci
sourcing routine respects its value.
Fixes: https://gitlab.haskell.org/ghc/ghc/issues/14689
Related: https://gitlab.haskell.org/ghc/ghc/issues/6017
Related: https://gitlab.haskell.org/ghc/ghc/issues/14250
Diffstat (limited to 'ghc/GHCi/UI/Monad.hs')
-rw-r--r-- | ghc/GHCi/UI/Monad.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ghc/GHCi/UI/Monad.hs b/ghc/GHCi/UI/Monad.hs index 16bcd20ee4..696303b949 100644 --- a/ghc/GHCi/UI/Monad.hs +++ b/ghc/GHCi/UI/Monad.hs @@ -15,6 +15,7 @@ module GHCi.UI.Monad ( GHCiState(..), GhciMonad(..), GHCiOption(..), isOptionSet, setOption, unsetOption, Command(..), CommandResult(..), cmdSuccess, + LocalConfigBehaviour(..), PromptFunction, BreakLocation(..), TickArray, @@ -79,6 +80,7 @@ data GHCiState = GHCiState prompt_cont :: PromptFunction, editor :: String, stop :: String, + localConfig :: LocalConfigBehaviour, options :: [GHCiOption], line_number :: !Int, -- ^ input line break_ctr :: !Int, @@ -197,6 +199,15 @@ data GHCiOption -- modules after load deriving Eq +-- | Treatment of ./.ghci files. For now we either load or +-- ignore. But later we could implement a "safe mode" where +-- only safe operations are performed. +-- +data LocalConfigBehaviour + = SourceLocalConfig + | IgnoreLocalConfig + deriving (Eq) + data BreakLocation = BreakLocation { breakModule :: !GHC.Module |