Skip to content

Commit 837fae8

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 fcc2b96 commit 837fae8

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
@@ -50,6 +50,9 @@ the Git ChangeLog, the GitHub repo https://github.com/ProofGeneral/PG
5050
during auto compilation.
5151
*** Fix issues #687 and #688 where the omit-proofs feature causes
5252
errors on correct code.
53+
*** Run Coq completely silent to fix #568. If you experience unexpected
54+
behavior, please report a bug and disable
55+
`coq-run-completely-silent' to switch back to old behavior.
5356

5457

5558
* 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
@@ -1246,15 +1265,17 @@ This function is called from `proof-shell-exec-loop' via
12461265
(and (string-match-p "BackTo\\s-" cmd)
12471266
(> (length coq-last-but-one-proofstack) coq--retract-naborts)))
12481267
(append
1268+
(unless coq-run-completely-silent '("Unset Silent."))
12491269
(if (coq--post-v810) (list (coq-diffs)) ())
1250-
;; '("Show.")
12511270
(coq--show-proof-stepwise-cmds)))
12521271

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

12591280
((or
12601281
;; If starting a proof, Show Proof if need be
@@ -1968,8 +1989,9 @@ at `proof-assistant-settings-cmds' evaluation time.")
19681989
;; When proof-shell-start-silent-cmd and proof-shell-stop-silent-cmd stay at
19691990
;; their default value nil, the generic code won't switch Coq to silent and
19701991
;; noisy at, respectively, the beginning and end of longer asserted regions.
1971-
;; (setq proof-shell-start-silent-cmd "Set Silent."
1972-
;; proof-shell-stop-silent-cmd "Unset Silent.")
1992+
(unless coq-run-completely-silent
1993+
(setq proof-shell-start-silent-cmd "Set Silent."
1994+
proof-shell-stop-silent-cmd "Unset Silent."))
19731995

19741996
;; prooftree config
19751997
(setq
@@ -3103,22 +3125,25 @@ Important: Coq gives char positions in bytes instead of chars.
31033125

31043126

31053127
(defun coq-show-goals-inside-proof (keep-response)
3106-
"Update goals buffer when action item list has been processed.
3107-
Add a Show command as priority action, such that it will still be
3108-
processed if the generic machinery inside `proof-shell-filter'
3109-
believes it has processed the last item from the action list.
3110-
When Coq runs in silent mode, we need to update the goals
3111-
precisely when everything else from the action list has been
3112-
processed.
3128+
"Update goals when action item list has been processed, if running silent.
3129+
If `coq-run-completely-silent' is set, add a Show command as
3130+
priority action, such that it will still be processed if the
3131+
generic machinery inside `proof-shell-filter' believes it has
3132+
processed the last item from the action list. When Coq runs in
3133+
silent mode, we need to update the goals precisely when
3134+
everything else from the action list has been processed.
31133135
31143136
The Show command is only added inside proofs and only if the last
31153137
processed command was not a show command from this function. The
31163138
action item flag `'dont-show-when-silent' is used for the latter.
31173139
31183140
KEEP-RESPONSE should be set if the last command produced some
31193141
error or response that should be kept and shown to the user. If
3120-
set, the flag `'keep-response' is added to the action item."
3121-
(when (and coq-last-but-one-proofstack
3142+
set, the flag `'keep-response' is added to the action item.
3143+
3144+
Do nothing if `coq-run-completely-silent' is disabled."
3145+
(when (and coq-run-completely-silent
3146+
coq-last-but-one-proofstack
31223147
(not (member 'dont-show-when-silent
31233148
proof-shell-delayed-output-flags)))
31243149
(let* ((flags-1 (list 'dont-show-when-silent 'invisible 'empty-action-list))

0 commit comments

Comments
 (0)