-
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
Open
andyqhan
wants to merge
12
commits into
ProofGeneral:master
Choose a base branch
from
andyqhan:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1f2120a
Add proof-shell-timeout-warn variables (see #514)
andyqhan 99cd00c
Add shell-internal variable for timer (see #514)
andyqhan d8d6104
Implement timeout message (see #514)
andyqhan ebea62f
fix parentheses
andyqhan 3ab6159
fix empty goals bug because of previous commit
andyqhan 9a38852
change timer config to one variable
andyqhan f8c0c09
Change warning text to clarify C-c C-c vs C-c C-x
andyqhan 11d8c59
cancel timer in the case of error or interrupt
andyqhan ae1b766
implement matafou's suggestions
989ef2e
Merge branch 'master' of https://github.com/ProofGeneral/PG
debe754
more fixes… seems to work lol
1cc7e70
arm timer every command, not every region
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,6 +149,13 @@ This flag is set for the duration of `proof-shell-kill-function' | |
to tell hooks in `proof-deactivate-scripting-hook' to refrain | ||
from calling `proof-shell-exit'.") | ||
|
||
(defvar proof-shell-timer nil | ||
"A timer that alerts the user when the current command sent to the | ||
shell is taking too long and might be malformed. This is cancelled | ||
in `proof-shell-exec-loop' or if there was an error and armed when | ||
the next command is sent to the process. | ||
Disable by setting `proof-shell-timeout-warn' to nil. Configure by | ||
setting `proof-shell-timeout-warn' to an integer.") | ||
|
||
|
||
;; | ||
|
@@ -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 | ||
;; if the shell isn't still busy, cancel timer on error | ||
(if (and proof-shell-timer proof-shell-timeout-warn) | ||
(progn (cancel-timer proof-shell-timer) | ||
(setq proof-shell-timer nil)))) | ||
(unless flags | ||
;; Give a hint about C-c C-`. (NB: approximate test) | ||
(if (pg-response-has-error-location) | ||
|
@@ -916,6 +928,19 @@ used in `proof-add-to-queue' when we start processing a queue, and in | |
;; Replace CRs from string with spaces to avoid spurious prompts. | ||
(if proof-shell-strip-crs-from-input | ||
(setq string (subst-char-in-string ?\n ?\ string))) | ||
;; arm the timer if we've received a user command (callback is proof-done-advancing) | ||
(when (and (eq 'proof-done-advancing action) | ||
proof-shell-timeout-warn) | ||
(when proof-shell-timer | ||
;; cancel previous timer, if it exists | ||
(cancel-timer proof-shell-timer) | ||
(setq proof-shell-timer nil)) | ||
(setq proof-shell-timer | ||
(run-with-timer proof-shell-timeout-warn nil | ||
'message | ||
(substitute-command-keys "This command is taking a while. \ | ||
Is the syntax correct? Do \\[proof-interrupt-process] to interrupt prover or | ||
\\[proof-shell-exit] to terminate it.")))) | ||
|
||
(insert string) | ||
|
||
|
@@ -1020,7 +1045,6 @@ being processed." | |
"proof-append-alist: wrong queuemode detected for busy shell") | ||
(cl-assert (eq proof-shell-busy queuemode))))) | ||
|
||
|
||
(let ((nothingthere (null proof-action-list))) | ||
;; Now extend or start the queue. | ||
(setq proof-action-list | ||
|
@@ -1188,7 +1212,11 @@ contains only invisible elements for Prooftree synchronization." | |
(proof-detach-queue) | ||
(unless flags ; hint after a batch of scripting | ||
(pg-processing-complete-hint)) | ||
(pg-finish-tracing-display)) | ||
(pg-finish-tracing-display) | ||
(when (and proof-shell-timeout-warn proof-shell-timer) | ||
;; cancel timer if there's nothing in the action lists | ||
(progn (cancel-timer proof-shell-timer) | ||
(setq proof-shell-timer nil)))) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The indentation seems wrong here. Would it be possible to fix that? |
||
(and (not proof-second-action-list-active) | ||
(let ((last-command (car (nth 1 (car (last proof-action-list)))))) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.