first try to resolve #322.
This commit is contained in:
parent
f799ff1ee8
commit
0fd8b9afd8
@ -22,12 +22,7 @@ checkSyntax :: IOish m
|
|||||||
=> [FilePath] -- ^ The target files.
|
=> [FilePath] -- ^ The target files.
|
||||||
-> GhcModT m String
|
-> GhcModT m String
|
||||||
checkSyntax [] = return ""
|
checkSyntax [] = return ""
|
||||||
checkSyntax files = withErrorHandler sessionName $
|
checkSyntax files = withErrorHandler $ either id id <$> check files
|
||||||
either id id <$> check files
|
|
||||||
where
|
|
||||||
sessionName = case files of
|
|
||||||
[file] -> file
|
|
||||||
_ -> "MultipleFiles"
|
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
@ -52,12 +47,7 @@ expandTemplate :: IOish m
|
|||||||
=> [FilePath] -- ^ The target files.
|
=> [FilePath] -- ^ The target files.
|
||||||
-> GhcModT m String
|
-> GhcModT m String
|
||||||
expandTemplate [] = return ""
|
expandTemplate [] = return ""
|
||||||
expandTemplate files = withErrorHandler sessionName $
|
expandTemplate files = withErrorHandler $ either id id <$> expand files
|
||||||
either id id <$> expand files
|
|
||||||
where
|
|
||||||
sessionName = case files of
|
|
||||||
[file] -> file
|
|
||||||
_ -> "MultipleFiles"
|
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -273,13 +273,13 @@ runGhcModT' r s a = do
|
|||||||
return (res, w')
|
return (res, w')
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
withErrorHandler :: IOish m => String -> GhcModT m a -> GhcModT m a
|
withErrorHandler :: IOish m => GhcModT m a -> GhcModT m a
|
||||||
withErrorHandler label = ghandle ignore
|
withErrorHandler = ghandle ignore
|
||||||
where
|
where
|
||||||
ignore :: IOish m => SomeException -> GhcModT m a
|
ignore :: IOish m => SomeException -> GhcModT m a
|
||||||
ignore e = liftIO $ do
|
ignore e = liftIO $ do
|
||||||
hPutStr stderr $ label ++ ":0:0:Error:"
|
|
||||||
hPrint stderr e
|
hPrint stderr e
|
||||||
|
-- FIXME: should print NG
|
||||||
exitSuccess
|
exitSuccess
|
||||||
|
|
||||||
-- | Make a copy of the 'gmGhcSession' IORef, run the action and restore the
|
-- | Make a copy of the 'gmGhcSession' IORef, run the action and restore the
|
||||||
|
@ -110,6 +110,18 @@ nil does not display errors/warnings.
|
|||||||
(setq mode-line-process (format " %d:%d" elen wlen)))))
|
(setq mode-line-process (format " %d:%d" elen wlen)))))
|
||||||
(force-mode-line-update))))
|
(force-mode-line-update))))
|
||||||
(t
|
(t
|
||||||
|
(let* ((err (buffer-substring-no-properties (point-min) (point)))
|
||||||
|
(info (ghc-make-hilit-info
|
||||||
|
:file "Fail errors:"
|
||||||
|
:line 0
|
||||||
|
:coln 0
|
||||||
|
:msg err
|
||||||
|
:err t
|
||||||
|
:hole nil))
|
||||||
|
(infos (list info))
|
||||||
|
(file ghc-process-original-file)
|
||||||
|
(buf ghc-process-original-buffer))
|
||||||
|
(ghc-check-highlight-original-buffer file buf infos))
|
||||||
(ghc-with-current-buffer ghc-process-original-buffer
|
(ghc-with-current-buffer ghc-process-original-buffer
|
||||||
(setq mode-line-process " failed")
|
(setq mode-line-process " failed")
|
||||||
(force-mode-line-update)))))
|
(force-mode-line-update)))))
|
||||||
|
Loading…
Reference in New Issue
Block a user