-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optional timeout warning when waiting for the proof shell #516
base: master
Are you sure you want to change the base?
Conversation
The previous commits’ proof-shell.el had the timeout cancel in the wrong place, leading to a bug with an empty buffer.
also minor whitespace formatting to match with master
also clarify documentation
Sorry for the delay, I will review your PR shortly. Thanks for it! |
@@ -738,6 +745,11 @@ unless the FLAGS for the command are non-nil (see `proof-action-list')." | |||
;; proof-action-list is empty on error. | |||
(setq proof-action-list nil) | |||
(proof-release-lock) | |||
(unless proof-shell-busy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure this test is necessary. Why would the shell be busy if an error is detected? Probably not harmful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it in, but can remove if you'd like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General remarks. Other remarks in the code.
- You should probably not make a PR from your own "master" branch. You should define a dedicated branch in you repository instead. No big deal.
- While testing I noticed that the message is displayed sometimes apparently for no reason. It seems this happens when PG processes comments. Maybe because in this cases PG do not send anything to coq actually, and this gets no response either. Probably a missing cancel-timer somewhere. I will investigate a bit more.
This almost good I would say.
It is just that the timer should not be launched when the semi's type is |
@Matafou I've implemented your suggestions — thank you so much for the review!
My bad, I'll make sure to do that in the future.
I changed the conditional for arming the timer to:
I'm not sure whether this is what you had in mind. |
Thanks for your contribution!
|
(if (and proof-shell-timer proof-shell-timeout-warn) | ||
(progn (cancel-timer proof-shell-timer) | ||
(setq proof-shell-timer nil)))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation seems wrong here. Would it be possible to fix that?
Thank you for the speedy review. I'm reconsidering the need for this PR, because I can't seem to get the MWE given in #514 to hang (probably because of the fixes in 0fdb1ae, I'm getting |
If you want a script where coq still hangs you can use this:
|
Ok, I believe I've fixed the issues. I'm not quite sure what to do with the case when someone can assert quickly multiple times in a row (the timer won't start if it's already running — that may help), but it now doesn't start the timer if the processed region was all comments. In order to do this, per @hendriktews 's suggestion, I've moved setting the timer to |
It seems to work, but is it really what we expect? |
No. It seems that my comment from March 21, that the approach followed here is also possible, was wrong. I would suggest to follow my outline in #514 instead. |
I moved the timer setup to (I believe those two tests are failing because of some problem fetching from Docker servers? Not sure) |
With bad tactics in Coq (#514), Proof General will hang forever (but can be interrupted with
C-c C-c
orC-c C-x
). In response to @hendriktews's workaround suggestion, this PR exposes a variableproof-shell-timeout-warn
that, if an integer, enables a minibuffer warning after waiting on the proof shell for more thanproof-shell-timeout-warn
seconds.It doesn't fix the core issue, but the minibuffer warning will remind users of using
C-c C-c
andC-c C-x
to cancel scripting.The text of the warning is "This command is taking a while. Is it malformed? Do C-c C-c or C-c C-x to abort." Default timeout is 30 seconds.