restore exactly named target, prevent non-named targets to participate in the ad-hoc switch game
--- a/src/Pure/Isar/named_target.ML Wed Jul 02 08:03:48 2014 +0200
+++ b/src/Pure/Isar/named_target.ML Wed Jul 02 08:03:49 2014 +0200
@@ -42,6 +42,11 @@
SOME ("", _) => true
| _ => false;
+fun target_of lthy =
+ case get_data lthy of
+ NONE => error "Not in a named target"
+ | SOME (target, _) => target;
+
fun locale_name_of NONE = NONE
| locale_name_of (SOME ("", _)) = NONE
| locale_name_of (SOME (locale, _)) = SOME locale;
@@ -182,7 +187,7 @@
| switch NONE (Context.Proof lthy) =
(Context.Proof o Local_Theory.restore, lthy)
| switch (SOME name) (Context.Proof lthy) =
- (Context.Proof o init (the (locale_of lthy)) o exit,
+ (Context.Proof o init (target_of lthy) o exit,
(begin name o exit o Local_Theory.assert_nonbrittle) lthy);
end;