src/Pure/Interface/proof_general.ML
changeset 9821 095beeef58ae
parent 9775 da698a96c4f3
child 9918 dab013ea6b63
equal deleted inserted replaced
9820:2aa2871d0dec 9821:095beeef58ae
   153     end) ();
   153     end) ();
   154 
   154 
   155 
   155 
   156 (* get informed about files *)
   156 (* get informed about files *)
   157 
   157 
   158 (* FIXME improve, e.g. do something like pretend_use_thy *)
   158 val touch_child_thys = ThyInfo.if_known_thy ThyInfo.touch_child_thys;
   159 fun inform_file_processed file =
   159 
   160   ThyInfo.if_known_thy ThyInfo.touch_child_thys (thy_name file);
   160 val inform_file_processed = touch_child_thys o thy_name;
   161 
   161 val inform_file_retracted = touch_child_thys o thy_name;
   162 fun inform_file_retracted file =
   162 
   163   ThyInfo.if_known_thy ThyInfo.touch_child_thys (thy_name file);
   163 fun proper_inform_file_processed file state =
       
   164   let val name = thy_name file in
       
   165     touch_child_thys name;
       
   166     if not (Toplevel.is_toplevel state) then
       
   167       warning ("Not at toplevel -- cannot register theory " ^ quote name)
       
   168     else Library.transform_error ThyInfo.pretend_use_thy_only name handle ERROR_MESSAGE msg =>
       
   169       (warning msg; warning ("Failed to register theory " ^ quote name))
       
   170   end;
   164 
   171 
   165 
   172 
   166 (* misc commands for ProofGeneral/isa *)
   173 (* misc commands for ProofGeneral/isa *)
   167 
   174 
   168 fun thms_containing cs = ThmDatabase.print_thms_containing (the_context ()) cs;
   175 fun thms_containing cs = ThmDatabase.print_thms_containing (the_context ()) cs;
   203 
   210 
   204 (* outer syntax *)
   211 (* outer syntax *)
   205 
   212 
   206 local structure P = OuterParse and K = OuterSyntax.Keyword in
   213 local structure P = OuterParse and K = OuterSyntax.Keyword in
   207 
   214 
   208 val old_undoP = (* FIXME same name for compatibility with PG/Isabelle99 *)
   215 val old_undoP = (*same name for compatibility with PG/Isabelle99*)
   209   OuterSyntax.improper_command "undo" "undo last command (no output)" K.control
   216   OuterSyntax.improper_command "undo" "undo last command (no output)" K.control
   210     (Scan.succeed (Toplevel.no_timing o IsarCmd.undo));
   217     (Scan.succeed (Toplevel.no_timing o IsarCmd.undo));
   211 
   218 
   212 val undoP =
   219 val undoP =
   213   OuterSyntax.improper_command "ProofGeneral.undo" "(internal)" K.control
   220   OuterSyntax.improper_command "ProofGeneral.undo" "(internal)" K.control
   231     (Scan.succeed (Toplevel.no_timing o IsarCmd.kill_proof_notify tell_clear_goals));
   238     (Scan.succeed (Toplevel.no_timing o IsarCmd.kill_proof_notify tell_clear_goals));
   232 
   239 
   233 val inform_file_processedP =
   240 val inform_file_processedP =
   234   OuterSyntax.improper_command "ProofGeneral.inform_file_processed" "(internal)" K.control
   241   OuterSyntax.improper_command "ProofGeneral.inform_file_processed" "(internal)" K.control
   235     (P.name >> (Toplevel.no_timing oo
   242     (P.name >> (Toplevel.no_timing oo
   236       (fn name => Toplevel.imperative (fn () => inform_file_processed name))));
   243       (fn name => Toplevel.keep (proper_inform_file_processed name))));
   237 
   244 
   238 val inform_file_retractedP =
   245 val inform_file_retractedP =
   239   OuterSyntax.improper_command "ProofGeneral.inform_file_retracted" "(internal)" K.control
   246   OuterSyntax.improper_command "ProofGeneral.inform_file_retracted" "(internal)" K.control
   240     (P.name >> (Toplevel.no_timing oo
   247     (P.name >> (Toplevel.no_timing oo
   241       (fn name => Toplevel.imperative (fn () => inform_file_retracted name))));
   248       (fn name => Toplevel.imperative (fn () => inform_file_retracted name))));