Skip to content

Commit 1a37480

Browse files
committed
coq: clear goals buffer after admitted
Only add the declaration info message to the right regular expression and generic Proof General will clear the goals buffer. As a side effect the declaration info message won't show up in the response buffer any more. Need to change the tests that rely on this.
1 parent 1566fd8 commit 1a37480

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ goals buffer is not empty afterwards."
174174
(goals-after-test coq-src-error "error"))
175175

176176
(ert-deftest goals-reset-after-admitted ()
177-
:expected-result :failed
178177
"The goals buffer is reset after an Admitted."
179178
(message
180179
"goals-reset-after-admitted: Check that goals are reset after Admitted.")

ci/simple-tests/coq-test-omit-proofs.el

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ configured there may be taken from faces with less priority."
9292
"Test the omit proofs feature.
9393
In particular, test that with proof-omit-proofs-option configured:
9494
- the proof _is_ processed when using a prefix argument
95-
- in this case the proof as normal locked color
95+
- in this case the proof has normal locked color
9696
- without prefix arg, the proof is omitted
9797
- the proof has omitted color then
9898
- stuff before the proof still has normal color "
99+
(message "omit-proofs-omit-and-not-omit: Check several omit proofs features")
99100
(setq proof-omit-proofs-option t
100101
proof-three-window-enable nil)
101102
(reset-coq)
@@ -154,10 +155,21 @@ In particular, test that with proof-omit-proofs-option configured:
154155
(forward-line -1)
155156
(proof-goto-point)
156157
(wait-for-coq)
157-
(with-current-buffer "*response*"
158-
(goto-char (point-min))
159-
;; There should be a declared message.
160-
(should (looking-at "classic_excluded_middle is declared")))
158+
(with-current-buffer "*coq*"
159+
;; There should be an Admit at the second last prompt without error.
160+
(goto-char (point-max))
161+
(should (search-backward "</prompt>" nil t 2))
162+
;; move behind prompt
163+
(forward-char 9)
164+
(should (looking-at "Admitted\\.\n"))
165+
(forward-line 1)
166+
;; There may be an info message about the declaration. The message
167+
;; may be spread over several lines.
168+
(when (looking-at "<infomsg>")
169+
(should (search-forward "</infomsg>" nil t))
170+
(forward-line 1))
171+
;; no other messages or errors before the next prompt
172+
(should (looking-at "\n<prompt>Coq <")))
161173

162174
;; Check 4: check proof-omitted-proof-face is active at marker 3
163175
(message "4: check proof-omitted-proof-face is active at marker 3")
@@ -184,6 +196,7 @@ the normal `proof-locked-face'.
184196
185197
The sources for the test contain a local attribute in form of
186198
'#[local]', which has been introduced only in Coq version 8.9."
199+
(message "omit-proofs-never-omit-hints: Check omit proofs feature with Hint")
187200
(skip-unless coq--post-v809)
188201
(setq proof-omit-proofs-option t
189202
proof-three-window-enable nil)
@@ -206,6 +219,7 @@ Test that proofs for Let local declarations are never omitted and
206219
that proofs of theorems following a Let definition are omitted.
207220
208221
This test only checks the faces in the middle of the proof."
222+
(message "omit-proofs-never-omit-lets: Check omit proofs feature with Let")
209223
(setq proof-omit-proofs-option t
210224
proof-three-window-enable nil)
211225
(reset-coq)

coq/coq.el

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,20 @@ Namely, goals that do not fit in the goals window."
145145
;; "Add LoadPath \"%s\"." ;; fixes unadorned Require (if .vo exists).
146146
"*Command of the inferior process to change the directory.")
147147

148-
(defvar coq-shell-proof-completed-regexp "No\\s-+more\\s-+\\(?:sub\\)?goals\\.\\|Subtree\\s-proved!\\|Proof\\s-completed"; \\|This subproof is complete
149-
"*Regular expression indicating that the proof has been completed.")
148+
(defvar coq-shell-proof-completed-regexp
149+
(concat "No\\s-+more\\s-+\\(?:sub\\)?goals\\.\\|Subtree\\s-proved!\\|"
150+
"Proof\\s-completed\\|"
151+
;; if printing width is small, eg. when running in batch mode,
152+
;; there might be a line break after infomsg
153+
"<infomsg>\n?.*\\s-is\\s-declared"
154+
;; \\|This subproof is complete
155+
)
156+
"*Regular expression indicating that the proof has been completed.
157+
Coq instance of `proof-shell-clear-goals-regexp'. Used in
158+
`proof-shell-process-urgent-message' to determine if the goals
159+
buffer shall be cleaned. Some of the messages recognized here are
160+
not printed by Coq in silent mode, such that Proof General might
161+
fail to delete the goals buffer.")
150162

151163
(defvar coq-goal-regexp
152164
"\\(============================\\)\\|\\(\\(?:sub\\)?goal [0-9]+\\)\n")

generic/proof-shell.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
;; proof-shell-filter-wrapper
3636
;; -> proof-shell-filter
3737
;; -> proof-shell-process-urgent-messages
38+
;; -> proof-shell-process-urgent-message
3839
;; -> proof-shell-filter-manage-output
3940
;; -> proof-shell-handle-immediate-output
4041
;; -> proof-shell-exec-loop

0 commit comments

Comments
 (0)