Commit e212079d authored by Ian Lynagh's avatar Ian Lynagh
Browse files

In ghci, reload after :e. Patch from Paolo Capriotti. Fixes #5343

parent 11ad9277
......@@ -126,7 +126,7 @@ builtin_commands = [
("def", keepGoing (defineMacro False), completeExpression),
("def!", keepGoing (defineMacro True), completeExpression),
("delete", keepGoing deleteCmd, noCompletion),
("edit", keepGoing editFile, completeFilename),
("edit", keepGoing' editFile, completeFilename),
("etags", keepGoing createETagsFileCmd, completeFilename),
("force", keepGoing forceCmd, completeExpression),
("forward", keepGoing forwardCmd, noCompletion),
......@@ -1053,15 +1053,16 @@ trySuccess act =
-----------------------------------------------------------------------------
-- :edit
editFile :: String -> GHCi ()
editFile :: String -> InputT GHCi ()
editFile str =
do file <- if null str then chooseEditFile else return str
st <- getGHCiState
do file <- if null str then lift chooseEditFile else return str
st <- lift getGHCiState
let cmd = editor st
when (null cmd)
$ ghcError (CmdLineError "editor not set, use :set editor")
_ <- liftIO $ system (cmd ++ ' ':file)
return ()
code <- liftIO $ system (cmd ++ ' ':file)
when (code == ExitSuccess)
$ reloadModule ""
-- The user didn't specify a file so we pick one for them.
-- Our strategy is to pick the first module that failed to load,
......
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