aboutsummaryrefslogtreecommitdiff
path: root/coq/coq.el
diff options
context:
space:
mode:
authorErik Martin-Dorel2020-05-29 19:56:44 +0200
committerGitHub2020-05-29 19:56:44 +0200
commit5ba7aee8a8996b8219a6e9dbde645e53684afbca (patch)
tree297503b50c51cc04a60609e42e6140d4ed2177de /coq/coq.el
parent0bfd208037646a1e1871dae9fc6fc6be0f7bd39c (diff)
parent9c82b71d396b425337592f96f2e9b6a1d97be0c0 (diff)
Merge pull request #490 from ProofGeneral/feature/487
Improve PG support of Show Proof (Diffs): Display the proof terms stepwise in the *response* buffer. Close #487
Diffstat (limited to 'coq/coq.el')
-rw-r--r--coq/coq.el61
1 files changed, 55 insertions, 6 deletions
diff --git a/coq/coq.el b/coq/coq.el
index 71112fc1..efa60349 100644
--- a/coq/coq.el
+++ b/coq/coq.el
@@ -160,6 +160,16 @@ See also option `coq-hide-additional-subgoals'."
:type '(choice regexp (const nil))
:group 'coq)
+(defcustom coq-show-proof-stepwise nil
+ "Display the proof terms stepwise in the *response* buffer.
+This option can be combined with option `coq-diffs'.
+It is mostly useful in three window mode, see also
+`proof-three-window-mode-policy' for details."
+
+ :type 'boolean
+ :safe 'booleanp
+ :group 'coq-auto-compile)
+
;;
;; prooftree customization
;;
@@ -1199,7 +1209,9 @@ Printing All set."
"Return the list of commands to send to Coq after CMD
if it is the last command of the action list.
If CMD is tagged with 'empty-action-list then this function won't
-be called and no command will be sent to Coq."
+be called and no command will be sent to Coq.
+Note: the last command added if `coq-show-proof-stepwise' is set
+should match the `coq-show-proof-diffs-regexp'."
(cond
((or
;; If closing a nested proof, Show the enclosing goal.
@@ -1208,21 +1220,56 @@ be called and no command will be sent to Coq."
;; If user issued a printing option then t printing.
(and (string-match-p "\\(S\\|Uns\\)et\\s-+Printing" cmd)
(> (length coq-last-but-one-proofstack) 0)))
- (list "Show."))
+ (let ((showlist (list "Show.")))
+ (when coq-show-proof-stepwise
+ (add-to-list 'showlist
+ (if (coq--post-v811)
+ (or
+ (when (eq coq-diffs 'off) "Show Proof.")
+ (when (eq coq-diffs 'on) "Show Proof Diffs.")
+ (when (eq coq-diffs 'removed) "Show Proof Diffs removed."))
+ "Show Proof.")
+ t))
+ showlist))
+
((or
;; If we go back in the buffer and the number of abort is less than
;; the number of nested goals, then Unset Silent and Show the goal
(and (string-match-p "BackTo\\s-" cmd)
(> (length coq-last-but-one-proofstack) coq--retract-naborts)))
- ;; "Set Diffs" always re-prints the proof context with (if enabled) diffs
- (list "Unset Silent." (if (coq--post-v810) (coq-diffs) "Show.")))
+ (let ((showlist (list "Unset Silent." (if (coq--post-v810) (coq-diffs) "Show."))))
+ (when coq-show-proof-stepwise
+ (add-to-list 'showlist
+ (if (coq--post-v811)
+ (or
+ (when (eq coq-diffs 'off) "Show Proof.")
+ (when (eq coq-diffs 'on) "Show Proof Diffs." )
+ (when (eq coq-diffs 'removed) "Show Proof Diffs removed."))
+ "Show Proof.")
+ t))
+ showlist))
+
((or
;; If we go back in the buffer and not in the above case, then only Unset
;; silent (there is no goal to show). Still, we need to "Set Diffs" again
(string-match-p "BackTo\\s-" cmd))
(if (coq--post-v810)
- (list "Unset Silent." (coq-diffs))
- (list "Unset Silent.")))))
+ (list "Unset Silent." (coq-diffs) )
+ (list "Unset Silent.")))
+ ((or
+ ;; If starting a proof, Show Proof if need be
+ (coq-goal-command-str-p cmd)
+ ;; If doing (not closing) a proof, Show Proof if need be
+ (and (not (string-match-p coq-save-command-regexp-strict cmd))
+ (> (length coq-last-but-one-proofstack) 0)))
+ (when coq-show-proof-stepwise
+ (if (coq--post-v811)
+ (or
+ (when (eq coq-diffs 'off) (list "Show Proof." ))
+ (when (eq coq-diffs 'on) (list "Show Proof Diffs."))
+ (when (eq coq-diffs 'removed) (list "Show Proof Diffs removed.")))
+ (list "Show Proof."))))))
+
(defpacustom auto-adapt-printing-width t
"If non-nil, adapt automatically printing width of goals window.
@@ -1890,6 +1937,8 @@ at `proof-assistant-settings-cmds' evaluation time.")
proof-save-command "Save %s. "
proof-find-theorems-command "Search %s. ")
+ (setq proof-show-proof-diffs-regexp coq-show-proof-diffs-regexp)
+
(setq proof-shell-empty-action-list-command 'coq-empty-action-list-command)
;; FIXME da: Does Coq have a help or about command?