Skip to content
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

Improve PG support of Show Proof Diffs #490

Merged
merged 13 commits into from
May 29, 2020
Merged

Improve PG support of Show Proof Diffs #490

merged 13 commits into from
May 29, 2020

Conversation

CyrilAnac
Copy link
Contributor

@CyrilAnac CyrilAnac commented May 19, 2020

Close #487

@CyrilAnac CyrilAnac requested a review from erikmd May 19, 2020 12:48
@CyrilAnac CyrilAnac changed the title Feature/487 Improve PG support of Show Proof Diffs May 19, 2020
Copy link
Member

@erikmd erikmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @CyrilAnac, I added several comments you could take into account till next meeting,
also it seems the current code make a CI test fail, maybe you can have a look as well (or we'll discuss this next week)

coq/coq-compile-common.el Outdated Show resolved Hide resolved
coq/coq-compile-common.el Outdated Show resolved Hide resolved
coq/coq-showdiff.el Outdated Show resolved Hide resolved
coq/coq-syntax.el Outdated Show resolved Hide resolved
generic/proof-config.el Outdated Show resolved Hide resolved
generic/proof-shell.el Outdated Show resolved Hide resolved
generic/proof-shell.el Outdated Show resolved Hide resolved
coq/coq.el Outdated Show resolved Hide resolved
coq/coq.el Outdated Show resolved Hide resolved
generic/proof-shell.el Outdated Show resolved Hide resolved
@CyrilAnac CyrilAnac marked this pull request as draft May 20, 2020 06:43
@CyrilAnac CyrilAnac marked this pull request as ready for review May 20, 2020 12:20
@CyrilAnac
Copy link
Contributor Author

@erikmd The feature seems to work now, I'm waiting for an other review or merging approve.

Copy link
Contributor

@Matafou Matafou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me. github shows strang indentation, is it due to tab indent?

@Matafou
Copy link
Contributor

Matafou commented May 20, 2020

General question: what will happen if we switch to the "always silent. Do Show when needed" described here #467 (comment)?
Same question for the "Show goal Diff" feature.

@erikmd
Copy link
Member

erikmd commented May 20, 2020

Thanks @CyrilAnac ! the feature looks very nice.

However it seems the following bug is introduced:

(1) when opening a .v file

Lemma test : forall n : nat, n = n.
  reflexivity. (* (2) then doing "C-c C-RET" to here *)

(3) and finally doing "C-c C-u" to backtrack, we get:

condition-case: Wrong type argument: stringp, nil

− I'm using Coq 8.11.1 on GNU/Linux

@erikmd
Copy link
Member

erikmd commented May 20, 2020

Hi @Matafou

General question: what will happen if we switch to the "always silent. Do Show when needed" described here #467 (comment)?
Same question for the "Show goal Diff" feature.

From my understanding the features are not incompatible but essentially orthogonal.

To summarize the situation:

coq/coq-syntax.el Outdated Show resolved Hide resolved
coq/coq.el Outdated Show resolved Hide resolved
@erikmd
Copy link
Member

erikmd commented May 20, 2020

Thanks @CyrilAnac ! the feature looks very nice.

However it seems the following bug is introduced:

(1) when opening a .v file

Lemma test : forall n : nat, n = n.
  reflexivity. (* (2) then doing "C-c C-RET" to here *)

(3) and finally doing "C-c C-u" to backtrack, we get:

condition-case: Wrong type argument: stringp, nil

− I'm using Coq 8.11.1 on GNU/Linux

Apparently this can be reproduced by directly processing the first line of test_stepwise.v till the end of a comment. I added a regression test (that will fail for now)

coq/coq.el Show resolved Hide resolved
coq/coq.el Outdated Show resolved Hide resolved
@CyrilAnac
Copy link
Contributor Author

Thanks @CyrilAnac ! the feature looks very nice.
However it seems the following bug is introduced:
(1) when opening a .v file

Lemma test : forall n : nat, n = n.
  reflexivity. (* (2) then doing "C-c C-RET" to here *)

(3) and finally doing "C-c C-u" to backtrack, we get:

condition-case: Wrong type argument: stringp, nil

− I'm using Coq 8.11.1 on GNU/Linux

Apparently this can be reproduced by directly processing the first line of test_stepwise.v till the end of a comment. I added a regression test (that will fail for now)

@erikmd Indeed, I introduced a bug here, the result of (car (nth 1 (car (last proof-action-list)))) is nil and the string-match-p throw a wrong type argument error.
The incoming commit should fix this issue.

Copy link
Member

@erikmd erikmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @CyrilAnac !

BTW if you have some time, you might want to add one or two unit tests (?)

@erikmd
Copy link
Member

erikmd commented May 25, 2020

Also before merging this feature, it'd be great to have users test it a little bit further (notably to ensure there is no unforeseen regression), maybe @jfehrle or @anton-trunov would have the time to do this?

FYI to retrieve the code of this PR it should suffice to uninstall proof-general from MELPA and follow https://github.com/ProofGeneral/PG#using-git-manual-compilation-procedure then do:

cd ~/.emacs.d/lisp/PG
git config --global alias.pr '!f() { if [ $# -lt 1 ]; then echo "Usage: git pr <id> [<remote>]  # assuming <remote>[=origin] is on GitHub"; else git checkout -q "$(git rev-parse --verify HEAD)" && git fetch -fv "${2:-origin}" pull/"$1"/head:pr/"$1" && git checkout pr/"$1"; fi; }; f'
git pr 490
make clean
# make  # optional

and the two options at stake are: Coq > Diffs > on and Coq > Show Proof (Diffs), see screenshot below.

2020-05-25_12-31-01_Screenshot_Show_Proof

@erikmd
Copy link
Member

erikmd commented May 25, 2020

Sorry, the feature is not yet ready.

BTW if you have some time, you might want to add one or two unit tests (?)

we definitely should add such tests!

I've spotted the following two bugs:

  1. If we enable "Coq Diffs" and "Show Proof", with Coq 8.10, interaction is broken (because Coq Diffs are available in Coq 8.10, but not Show Proof Diffs, which have been introduced in coq/coq@5ec7eca) → Cyril could you add some appropriate conditions (if (coq--post-v811) …)? (I've updated the CI configuration to also test with Coq 8.9 and Coq 8.10, but we should also add some tests that make the ci/test.sh script fail with Coq 8.10)

  2. If "Coq Diffs" and "Show Proof" are disabled and we backtrack (e.g. with Coq 8.10) then run C-c C-n, then the frontend loops…

@jfehrle
Copy link
Contributor

jfehrle commented May 26, 2020

Coq Diffs are available in Coq 8.10, but not Show Proof Diffs, which have been introduced in coq/coq@5ec7eca) → Cyril could you add some appropriate conditions (if (coq--post-v811) …)

Show Proof Diffs is in 8.11. Perhaps you meant "if (coq--post-v810)"?

maybe @jfehrle or @anton-trunov would have the time to do this?

I don't use PG or emacs on a regular basis. Looks like I don't even have emacs installed on my new laptop. Perhaps Anton would be willing to try it first.

@erikmd
Copy link
Member

erikmd commented May 26, 2020

Hi @jfehrle, thanks for your comment.

Perhaps you meant "if (coq--post-v810)"?

nope: the (coq--post-v811) is actually a :)

PG/coq/coq-system.el

Lines 200 to 202 in 8273e22

(defun coq--post-v811 ()
"Return t if the auto-detected version of Coq is >= 8.11.
Return nil if the version cannot be detected."

@CyrilAnac CyrilAnac force-pushed the feature/487 branch 2 times, most recently from a2752ce to 5988d44 Compare May 28, 2020 09:39
Copy link
Member

@erikmd erikmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @CyrilAnac, I can confirm the backtracking bug is fixed!
I just left a few minor comments.

ci/coq-tests.el Outdated Show resolved Hide resolved
ci/coq-tests.el Outdated Show resolved Hide resolved
ci/coq-tests.el Outdated Show resolved Hide resolved
ci/coq-tests.el Outdated Show resolved Hide resolved
ci/coq-tests.el Outdated Show resolved Hide resolved
ci/coq-tests.el Outdated Show resolved Hide resolved
ci/coq-tests.el Outdated Show resolved Hide resolved
coq/coq.el Outdated Show resolved Hide resolved
Copy link
Member

@erikmd erikmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @CyrilAnac, I've re-tested with Coq 8.11.1 and the PR looks very fine now!

Cc @ProofGeneral/core I propose to merge this tonight if you don't object.

@Matafou
Copy link
Contributor

Matafou commented May 29, 2020

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve PG support of Show Proof Diffs
4 participants