X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fmatita%2FmatitaScript.ml;h=ce613ef7180fd1fdc5b68d9779f338e462393446;hb=18b2b2742fe8ebb3d11b32b9bb727f510df6927a;hp=965969a217855a611cdb309518744553aedff1cf;hpb=646ade789430669f4a6be3ecbf47d89fe865f132;p=helm.git diff --git a/helm/matita/matitaScript.ml b/helm/matita/matitaScript.ml index 965969a21..ce613ef71 100644 --- a/helm/matita/matitaScript.ml +++ b/helm/matita/matitaScript.ml @@ -326,15 +326,15 @@ object (self) match filename with Some f -> f | None -> sprintf ".unnamed%d.ma" scriptId initializer - ignore(GMain.Timeout.add ~ms:30000 + ignore(GMain.Timeout.add ~ms:300000 ~callback:(fun _ -> self#_saveToBackuptFile ();true)); - set_star self#ppFilename false; ignore(buffer#connect#modified_changed (fun _ -> if buffer#modified then set_star self#ppFilename true else set_star self#ppFilename false)); - self#reset () + self#reset (); + self#template () val mutable statements = []; (** executed statements *) val mutable history = [ init ]; @@ -396,13 +396,17 @@ List.iter (fun s -> prerr_endline ("'" ^ s ^ "'")) new_statements; try self#_advance ?statement (); self#notify - with Margin -> () + with + | Margin -> self#notify + | exc -> self#notify; raise exc method retract () = try self#_retract (); self#notify - with Margin -> () + with + | Margin -> self#notify + | exc -> self#notify; raise exc method private getFuture = buffer#get_text ~start:(buffer#get_iter_at_mark (`MARK locked_mark)) @@ -476,7 +480,15 @@ List.iter (fun s -> prerr_endline ("'" ^ s ^ "'")) new_statements; method reset () = self#goto_top; buffer#delete ~start:buffer#start_iter ~stop:buffer#end_iter; - self#notify + self#notify; + buffer#set_modified false + + method template () = + let template = MatitaMisc.input_file BuildTimeConf.script_template in + buffer#insert ~iter:(buffer#get_iter `START) template; + filename <- None; + buffer#set_modified false; + set_star self#ppFilename false method goto (pos: [`Top | `Bottom | `Cursor]) () = match pos with @@ -491,7 +503,9 @@ List.iter (fun s -> prerr_endline ("'" ^ s ^ "'")) new_statements; in dowhile (getpos ()); self#notify - with Margin -> ()) + with + | Margin -> self#notify + | exc -> self#notify; raise exc) | `Cursor -> let locked_iter () = buffer#get_iter_at_mark (`NAME "locked") in let cursor_iter () = buffer#get_iter_at_mark `INSERT in @@ -513,8 +527,10 @@ List.iter (fun s -> prerr_endline ("'" ^ s ^ "'")) new_statements; (back_until_cursor (); self#notify) else (* cursor = locked *) () - with Margin -> ()) - + with + | Margin -> self#notify + | exc -> self#notify; raise exc) + method onGoingProof () = match self#status.proof_status with | No_proof | Proof _ -> false