Commit af7840ec authored by Ian Lynagh's avatar Ian Lynagh

Add a flag -fno-ghci-history

Allows you to turn off loading/storing the GHCi command history from/to
the ~/.ghc/ghci_history file.
parent b5b4aae4
......@@ -278,6 +278,7 @@ data DynFlag
| Opt_SSE2
| Opt_SSE4_2
| Opt_GhciSandbox
| Opt_GhciHistory
| Opt_HelpfulErrors
-- temporary flags
......@@ -1741,6 +1742,7 @@ fFlags = [
( "ext-core", AlwaysAllowed, Opt_EmitExternalCore, nop ),
( "shared-implib", AlwaysAllowed, Opt_SharedImplib, nop ),
( "ghci-sandbox", AlwaysAllowed, Opt_GhciSandbox, nop ),
( "ghci-history", AlwaysAllowed, Opt_GhciHistory, nop ),
( "helpful-errors", AlwaysAllowed, Opt_HelpfulErrors, nop ),
( "building-cabal-package", AlwaysAllowed, Opt_BuildingCabalPackage, nop ),
( "implicit-import-qualified", AlwaysAllowed, Opt_ImplicitImportQualified, nop )
......@@ -1916,6 +1918,7 @@ defaultFlags
Opt_EmbedManifest,
Opt_PrintBindContents,
Opt_GhciSandbox,
Opt_GhciHistory,
Opt_HelpfulErrors
]
......
......@@ -2727,6 +2727,12 @@ phase <replaceable>n</replaceable></entry>
<entry>static</entry>
<entry>-</entry>
</row>
<row>
<entry><option>-fno-ghci-history</option></entry>
<entry>Do not use the load/store the GHCi command history from/to <literal>ghci_history</literal>.</entry>
<entry>dynamic</entry>
<entry>-</entry>
</row>
<row>
<entry><option>-fno-ghci-sandbox</option></entry>
<entry>Turn off the GHCi sandbox. Means computations are run in the main thread, rather than a forked thread.</entry>
......
......@@ -470,8 +470,11 @@ runGHCi paths maybe_exprs = do
runGHCiInput :: InputT GHCi a -> GHCi a
runGHCiInput f = do
histFile <- liftIO $ withGhcAppData (\dir -> return (Just (dir </> "ghci_history")))
(return Nothing)
dflags <- getDynFlags
histFile <- if dopt Opt_GhciHistory dflags
then liftIO $ withGhcAppData (\dir -> return (Just (dir </> "ghci_history")))
(return Nothing)
else return Nothing
let settings = setComplete ghciCompleteWord
$ defaultSettings {historyFile = histFile}
runInputT settings f
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment