Skip to content

Commit 140e076

Browse files
committed
clear goals buffer after Qed and Admitted when running silent
This solves the remaining known problems from #568. Fixes #568.
1 parent 678f990 commit 140e076

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

ci/simple-tests/coq-test-goals-present.el

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ which action the goals buffer should have been reset."
280280

281281
(ert-deftest goals-reset-after-admitted ()
282282
"The goals buffer is reset after an Admitted."
283-
:expected-result :failed
284283
(goals-buffer-should-get-reset coq-src-admitted "intros P" "Admitted"))
285284

286285
(ert-deftest goals-reset-no-more-goals ()
@@ -289,7 +288,6 @@ which action the goals buffer should have been reset."
289288
"Lemma a" "no more goals"))
290289

291290
(ert-deftest goals-reset-qed ()
292-
:expected-result :failed
293291
"The goals buffer is reset after Qed."
294292
(goals-buffer-should-get-reset coq-src-qed
295293
"Proof using" "Qed"))

coq/coq.el

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3213,8 +3213,15 @@ number of hypothesis displayed, without hiding the goal"
32133213
(coq-build-subgoals-string nbgoals nbunfocused)))
32143214
minor-mode-alist)))))))
32153215

3216-
3217-
3216+
(defun coq-clean-goals-outside-proof ()
3217+
"Clear goals buffer outside proofs.
3218+
This function ensures that the goals buffer is reset after Qed or
3219+
Admitted. This function is for
3220+
`proof-shell-handle-delayed-output-hook'."
3221+
(when (or (not coq-last-but-one-proofstack)
3222+
(proof-string-match coq-shell-proof-completed-regexp
3223+
proof-shell-last-output))
3224+
(proof-clean-buffer proof-goals-buffer)))
32183225

32193226

32203227
;; This hook must be added before coq-optimise-resp-windows, in order to be evaluated
@@ -3224,10 +3231,7 @@ number of hypothesis displayed, without hiding the goal"
32243231
(add-hook 'proof-shell-handle-delayed-output-hook
32253232
#'coq-update-minor-mode-alist)
32263233
(add-hook 'proof-shell-handle-delayed-output-hook
3227-
(lambda ()
3228-
(if (proof-string-match coq-shell-proof-completed-regexp
3229-
proof-shell-last-output)
3230-
(proof-clean-buffer proof-goals-buffer))))
3234+
#'coq-clean-goals-outside-proof)
32313235

32323236
(add-hook 'proof-shell-handle-delayed-output-hook
32333237
(lambda ()

0 commit comments

Comments
 (0)