127 |
127 |
128 (* history commands *) |
128 (* history commands *) |
129 |
129 |
130 fun cannot_undo txt = Toplevel.imperative (fn () => error ("Cannot undo " ^ quote txt)); |
130 fun cannot_undo txt = Toplevel.imperative (fn () => error ("Cannot undo " ^ quote txt)); |
131 val clear_undos_theory = Toplevel.history o History.clear; |
131 val clear_undos_theory = Toplevel.history o History.clear; |
132 val redo = Toplevel.history History.redo o Toplevel.proof ProofHistory.redo; |
132 val redo = Toplevel.history History.redo o Toplevel.proof'' ProofHistory.redo o |
133 |
133 Toplevel.skip_proof History.redo; |
134 fun undos_proof n = Toplevel.proof (fn prf => |
134 |
135 if ProofHistory.is_initial prf then raise Toplevel.UNDEF else funpow n ProofHistory.undo prf); |
135 fun undos_proof n = Toplevel.proof'' (fn prf => |
|
136 if ProofHistory.is_initial prf then raise Toplevel.UNDEF else funpow n ProofHistory.undo prf) o |
|
137 Toplevel.skip_proof (fn h => |
|
138 if History.is_initial h then raise Toplevel.UNDEF else funpow n History.undo h); |
136 |
139 |
137 fun kill_proof_notify (f: unit -> unit) = Toplevel.history (fn hist => |
140 fun kill_proof_notify (f: unit -> unit) = Toplevel.history (fn hist => |
138 (case History.current hist of |
141 (case History.current hist of |
139 Toplevel.Theory _ => raise Toplevel.UNDEF |
142 Toplevel.Theory _ => raise Toplevel.UNDEF |
140 | Toplevel.Proof _ => (f (); History.undo hist))); |
143 | _ => (f (); History.undo hist))); |
141 |
144 |
142 val kill_proof = kill_proof_notify (K ()); |
145 val kill_proof = kill_proof_notify (K ()); |
143 |
146 |
144 val undo_theory = Toplevel.history (fn hist => |
147 val undo_theory = Toplevel.history (fn hist => |
145 if History.is_initial hist then raise Toplevel.UNDEF else History.undo hist); |
148 if History.is_initial hist then raise Toplevel.UNDEF else History.undo hist); |