@@ -15,6 +15,7 @@ import Idris.ElabDecls
15import Idris.Error
15import Idris.Error
16import Idris.Delaborate
16import Idris.Delaborate
17import Idris.Output
17import Idris.Output
18+import Idris.IdeSlave hiding (IdeSlaveCommand(..))
19import Util.Pretty
20import Util.Pretty
20import Util.System
21import Util.System
@@ -23,6 +24,7 @@ import System.FilePath
23import System.Directory
24import System.Directory
24import System.IO
25import System.IO
25import Data.Char
26import Data.Char
27+import Data.Maybe (fromMaybe)
28caseSplitAt :: Handle -> FilePath -> Bool -> Int -> Name -> Idris ()
30caseSplitAt :: Handle -> FilePath -> Bool -> Int -> Name -> Idris ()
@@ -254,15 +256,32 @@ makeLemma h fn updatefile l n
254 do let fb = fn ++ "~"
256 do let fb = fn ++ "~"
255 runIO $ writeFile fb (addLem before tyline lem lem_app later)
257 runIO $ writeFile fb (addLem before tyline lem lem_app later)
256 runIO $ copyFile fb fn
258 runIO $ copyFile fb fn
259+ else case idris_outputmode i of
257− else ihPrintResult h $ lem ++ "\n" ++ lem_app
260+ RawOutput -> ihPrintResult h $ lem ++ "\n" ++ lem_app
262+ let good = SexpList [SymbolAtom "ok",
263+ SexpList [SymbolAtom "metavariable-lemma",
264+ SexpList [SymbolAtom "replace-metavariable",
265+ StringAtom lem_app],
266+ SexpList [SymbolAtom "definition-type",
268+ in runIO . hPutStrLn h $ convSExp "return" good n
258 else do -- provisional definition
270 else do -- provisional definition
259− let lem_app = show n ++ appArgs [] mty ++
271+ let lem_app = show n ++ appArgs [] mty ++
260 " = ?" ++ show n ++ "_rhs"
272 " = ?" ++ show n ++ "_rhs"
261 if updatefile then
273 if updatefile then
262 do let fb = fn ++ "~"
274 do let fb = fn ++ "~"
263 runIO $ writeFile fb (addProv before tyline lem_app later)
275 runIO $ writeFile fb (addProv before tyline lem_app later)
264 runIO $ copyFile fb fn
276 runIO $ copyFile fb fn
277+ else case idris_outputmode i of
265− else ihPrintResult h $ lem_app
278+ RawOutput -> ihPrintResult h $ lem_app
280+ let good = SexpList [SymbolAtom "ok",
281+ SexpList [SymbolAtom "provisional-definition-lemma",
282+ SexpList [SymbolAtom "definition-clause",
283+ StringAtom lem_app]]]
284+ in runIO . hPutStrLn h $ convSExp "return" good n
267 where getIndent s = length (takeWhile isSpace s)
286 where getIndent s = length (takeWhile isSpace s)
@@ -318,5 +337,3 @@ makeLemma h fn updatefile l n
318 unlines $ before ++ tyline :
337 unlines $ before ++ tyline :
319 (later_bef ++ [blankline, lem_app, blankline] ++
338 (later_bef ++ [blankline, lem_app, blankline] ++
320 later_end)
339 later_end)