summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorEugene Akentyev <ak3ntev@gmail.com>2016-08-31 14:31:39 -0400
committerBen Gamari <ben@smart-cactus.org>2016-08-31 14:31:45 -0400
commit1ad770f599a00e8f8919f7fcf4cf00800fd4d9ed (patch)
tree00301bfb6e907018107d14336761ef6ca27db5b7 /ghc
parent9cfef167dc0b2bfa881c5d9eca38227fbdfd507c (diff)
downloadhaskell-1ad770f599a00e8f8919f7fcf4cf00800fd4d9ed.tar.gz
Add -flocal-ghci-history flag (#9089).
Reviewers: thomie, bgamari, austin Reviewed By: thomie, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2461 GHC Trac Issues: #9089
Diffstat (limited to 'ghc')
-rw-r--r--ghc/GHCi/UI.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index 1e27c7a861..e3a56d6a06 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -613,10 +613,16 @@ runGHCi paths maybe_exprs = do
runGHCiInput :: InputT GHCi a -> GHCi a
runGHCiInput f = do
dflags <- getDynFlags
- histFile <- if gopt Opt_GhciHistory dflags
- then liftIO $ withGhcAppData (\dir -> return (Just (dir </> "ghci_history")))
- (return Nothing)
- else return Nothing
+ let ghciHistory = gopt Opt_GhciHistory dflags
+ let localGhciHistory = gopt Opt_LocalGhciHistory dflags
+ currentDirectory <- liftIO $ getCurrentDirectory
+
+ histFile <- case (ghciHistory, localGhciHistory) of
+ (True, True) -> return (Just (currentDirectory </> ".ghci_history"))
+ (True, _) -> liftIO $ withGhcAppData
+ (\dir -> return (Just (dir </> "ghci_history"))) (return Nothing)
+ _ -> return Nothing
+
runInputT
(setComplete ghciCompleteWord $ defaultSettings {historyFile = histFile})
f