aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--proofs/pfedit.ml10
1 files changed, 4 insertions, 6 deletions
diff --git a/proofs/pfedit.ml b/proofs/pfedit.ml
index 9be475ac4..02401dc03 100644
--- a/proofs/pfedit.ml
+++ b/proofs/pfedit.ml
@@ -36,8 +36,10 @@ let delete_proof = Proof_global.discard
let delete_current_proof = Proof_global.discard_current
let delete_all_proofs = Proof_global.discard_all
-let undo n =
+let undo n =
let p = Proof_global.give_me_the_proof () in
+ let d = Proof.V82.depth p in
+ if n >= d then raise Proof.EmptyUndoStack;
for i = 1 to n do
Proof.undo p
done
@@ -65,11 +67,7 @@ let start_proof id str hyps c ?init_tac ?compute_guard hook =
Proof_global.start_proof id str goals ?compute_guard hook;
Option.iter Proof_global.run_tactic init_tac
-let restart_proof () =
- let p = Proof_global.give_me_the_proof () in
- try while true do
- Proof.undo p
- done with Proof.EmptyUndoStack -> ()
+let restart_proof () = undo_todepth 1
let resume_last_proof () = Proof_global.resume_last ()
let resume_proof (_,id) = Proof_global.resume id