Ticket #5343: 5343.patch

File 5343.patch, 1.5 KB (added by pcapriotti, 15 months ago)

Reload module after invoking editor

  • ghc/InteractiveUI.hs

    diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
    index c92392d..81592c4 100644
    a b  
    126126  ("def",       keepGoing (defineMacro False),  completeExpression), 
    127127  ("def!",      keepGoing (defineMacro True),   completeExpression), 
    128128  ("delete",    keepGoing deleteCmd,            noCompletion), 
    129   ("edit",      keepGoing editFile,             completeFilename), 
     129  ("edit",      keepGoing' editFile,            completeFilename), 
    130130  ("etags",     keepGoing createETagsFileCmd,   completeFilename), 
    131131  ("force",     keepGoing forceCmd,             completeExpression), 
    132132  ("forward",   keepGoing forwardCmd,           noCompletion), 
     
    10441044----------------------------------------------------------------------------- 
    10451045-- :edit 
    10461046 
    1047 editFile :: String -> GHCi () 
     1047editFile :: String -> InputT GHCi () 
    10481048editFile str = 
    1049   do file <- if null str then chooseEditFile else return str 
    1050      st <- getGHCiState 
     1049  do file <- if null str then lift chooseEditFile else return str 
     1050     st <- lift getGHCiState 
    10511051     let cmd = editor st 
    10521052     when (null cmd) 
    10531053       $ ghcError (CmdLineError "editor not set, use :set editor") 
    1054      _ <- liftIO $ system (cmd ++ ' ':file) 
    1055      return () 
     1054     code <- liftIO $ system (cmd ++ ' ':file) 
     1055     when (code == ExitSuccess) 
     1056       $ reloadModule "" 
    10561057 
    10571058-- The user didn't specify a file so we pick one for them. 
    10581059-- Our strategy is to pick the first module that failed to load,