src/Pure/PIDE/document.ML
changeset 41537 3837045cc8a1
parent 40534 9e196062bf88
child 41629 5490dc4d999d
equal deleted inserted replaced
41536:47fef6afe756 41537:3837045cc8a1
   212       | errs => (errs, NONE))
   212       | errs => (errs, NONE))
   213   | NONE => ([ML_Compiler.exn_message Runtime.TERMINATE], NONE));
   213   | NONE => ([ML_Compiler.exn_message Runtime.TERMINATE], NONE));
   214 
   214 
   215 in
   215 in
   216 
   216 
   217 fun run_command thy_name tr st =
   217 fun run_command thy_name raw_tr st =
   218   (case
   218   (case
   219       (case Toplevel.init_of tr of
   219       (case Toplevel.init_of raw_tr of
   220         SOME name => Exn.capture (fn () => Thy_Header.consistent_name thy_name name) ()
   220         SOME name => Exn.capture (fn () =>
   221       | NONE => Exn.Result ()) of
   221           let
   222     Exn.Result () =>
   222             val path = Path.explode thy_name;
       
   223             val _ = Thy_Header.consistent_name (Path.implode (Path.base path)) name;
       
   224           in Toplevel.modify_master (SOME (Path.dir path)) raw_tr end) ()
       
   225       | NONE => Exn.Result raw_tr) of
       
   226     Exn.Result tr =>
   223       let
   227       let
   224         val is_init = is_some (Toplevel.init_of tr);
   228         val is_init = is_some (Toplevel.init_of tr);
   225         val is_proof = Keyword.is_proof (Toplevel.name_of tr);
   229         val is_proof = Keyword.is_proof (Toplevel.name_of tr);
   226         val do_print = not is_init andalso (Toplevel.print_of tr orelse is_proof);
   230         val do_print = not is_init andalso (Toplevel.print_of tr orelse is_proof);
   227 
   231 
   239               (true, st')));
   243               (true, st')));
   240       in res end
   244       in res end
   241   | Exn.Exn exn =>
   245   | Exn.Exn exn =>
   242       if Exn.is_interrupt exn then reraise exn
   246       if Exn.is_interrupt exn then reraise exn
   243       else
   247       else
   244        (Toplevel.error_msg tr (ML_Compiler.exn_message exn);
   248        (Toplevel.error_msg raw_tr (ML_Compiler.exn_message exn);
   245         Toplevel.status tr Markup.failed;
   249         Toplevel.status raw_tr Markup.failed;
   246         (false, Toplevel.toplevel)));
   250         (false, Toplevel.toplevel)));
   247 
   251 
   248 end;
   252 end;
   249 
   253 
   250 
   254