Skip to content

Commit 46f6f40

Browse files
committed
add option to disable silent and switch back to old (buggy) behavior
Add user option coq-run-completely-silent, which, when disabled, switches Coq to old behavior where Coq is dynamically switched to silent on longer action item lists.
1 parent b5b0255 commit 46f6f40

File tree

2 files changed

+44
-16
lines changed

2 files changed

+44
-16
lines changed

CHANGES

+3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ the Git ChangeLog, the GitHub repo https://github.com/ProofGeneral/PG
4141
during auto compilation.
4242
*** Fix issues #687 and #688 where the omit-proofs feature causes
4343
errors on correct code.
44+
*** Run Coq completely silent to fix #568. If you experience unexpected
45+
behavior, please report a bug and disable
46+
`coq-run-completely-silent' to switch back to old behavior.
4447

4548

4649
* Changes of Proof General 4.5 from Proof General 4.4

coq/coq.el

+41-16
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@
7676
;; :type 'number
7777
;; :group 'coq)
7878

79+
(defcustom coq-run-completely-silent t
80+
"Run Coq completely silent if enabled.
81+
Please restart Proof General after changing this setting!
82+
83+
If enabled, run Coq completely silent (Set Silent) and only issue
84+
a show command when necessary to update the goals buffer. This
85+
behavior is new. If you experience strange effects, please report
86+
a bug and switch this flag off to return to old behavior. When
87+
disabled, Coq is dynamically switched to silent for longer lists
88+
of commands and switched to verbose before the last command. A
89+
manual Show command (C-c C-p) is necessary if the last command
90+
fails to update the goals buffer (e.g., if it is a comment or it
91+
is not executed because some other command before failed, see
92+
also bug report #568)."
93+
:type 'boolean
94+
:safe 'booleanp
95+
:group 'coq)
96+
7997
(defcustom coq-user-init-cmd nil
8098
"User defined init commands for Coq.
8199
These are appended at the end of `coq-shell-init-cmd'."
@@ -122,16 +140,17 @@ Namely, goals that do not fit in the goals window."
122140
;; should re-intialize to coq-search-blacklist-string instead of
123141
;; keeping the current value (that may come from another file).
124142
,(format "Add Search Blacklist %s. " coq-search-blacklist-current-string))
125-
'("Set Suggest Proof Using. "
126-
"Set Silent. ")
143+
'("Set Suggest Proof Using. ")
144+
(if coq-run-completely-silent '("Set Silent. ") ())
127145
coq-user-init-cmd)
128146
"Commands for initial Coq configuration, Coq variant of `proof-shell-init-cmd'.
129147
List of commands sent to the Coq background process just after it
130148
has been started. This happens inside `proof-shell-config-done',
131149
when the major mode `coq-shell-mode' is configured in the `*coq*'
132150
buffer.
133151
134-
Sets silent mode.
152+
Sets silent mode if `coq-run-completely-silent' is set. Note that
153+
this constant is not updated when `coq-run-completely-silent' is changed.
135154
136155
In normal interaction, Coq is started because the user asserts
137156
some commands. Therefore the commands here are followed by those
@@ -1247,15 +1266,17 @@ This function is called from `proof-shell-exec-loop' via
12471266
(and (string-match-p "BackTo\\s-" cmd)
12481267
(> (length coq-last-but-one-proofstack) coq--retract-naborts)))
12491268
(append
1269+
(unless coq-run-completely-silent '("Unset Silent."))
12501270
(if (coq--post-v810) (list (coq-diffs)) ())
1251-
;; '("Show.")
12521271
(coq--show-proof-stepwise-cmds)))
12531272

12541273
((or
12551274
;; If we go back in the buffer and not in the above case, i.e., outside a
12561275
;; proof, then only set the Diffs option.
12571276
(string-match-p "BackTo\\s-" cmd))
1258-
(if (coq--post-v810) (list (coq-diffs)) ()))
1277+
(append
1278+
(unless coq-run-completely-silent '("Unset Silent."))
1279+
(if (coq--post-v810) (list (coq-diffs)) ())))
12591280

12601281
((or
12611282
;; If starting a proof, Show Proof if need be
@@ -1965,8 +1986,9 @@ at `proof-assistant-settings-cmds' evaluation time.")
19651986
;; When proof-shell-start-silent-cmd and proof-shell-stop-silent-cmd stay at
19661987
;; their default value nil, the generic code won't switch Coq to silent and
19671988
;; noisy at, respectively, the beginning and end of longer asserted regions.
1968-
;; (setq proof-shell-start-silent-cmd "Set Silent. "
1969-
;; proof-shell-stop-silent-cmd "Unset Silent. ")
1989+
(unless coq-run-completely-silent
1990+
(setq proof-shell-start-silent-cmd "Set Silent. "
1991+
proof-shell-stop-silent-cmd "Unset Silent. "))
19701992

19711993
;; prooftree config
19721994
(setq
@@ -3080,22 +3102,25 @@ buffer."
30803102

30813103

30823104
(defun coq-show-goals-inside-proof (keep-response)
3083-
"Update goals buffer when action item list has been processed.
3084-
Add a Show command as priority action, such that it will still be
3085-
processed if the generic machinery inside `proof-shell-filter'
3086-
believes it has processed the last item from the action list.
3087-
When Coq runs in silent mode, we need to update the goals
3088-
precisely when everything else from the action list has been
3089-
processed.
3105+
"Update goals when action item list has been processed, if running silent.
3106+
If `coq-run-completely-silent' is set, add a Show command as
3107+
priority action, such that it will still be processed if the
3108+
generic machinery inside `proof-shell-filter' believes it has
3109+
processed the last item from the action list. When Coq runs in
3110+
silent mode, we need to update the goals precisely when
3111+
everything else from the action list has been processed.
30903112
30913113
The Show command is only added inside proofs and only if the last
30923114
processed command was not a show command from this function. The
30933115
action item flag `'dont-show-when-silent' is used for the latter.
30943116
30953117
KEEP-RESPONSE should be set if the last command produced some
30963118
error or response that should be kept and shown to the user. If
3097-
set, the flag `'keep-response' is added to the action item."
3098-
(when (and coq-last-but-one-proofstack
3119+
set, the flag `'keep-response' is added to the action item.
3120+
3121+
Do nothing if `coq-run-completely-silent' is disabled."
3122+
(when (and coq-run-completely-silent
3123+
coq-last-but-one-proofstack
30993124
(not (member 'dont-show-when-silent
31003125
proof-shell-delayed-output-flags)))
31013126
(let* ((flags-1 (list 'dont-show-when-silent 'invisible 'empty-action-list))

0 commit comments

Comments
 (0)