First attempt of fixing elpi syntax by Philip Kaludercic.#847
Merged
Matafou merged 2 commits intoProofGeneral:masterfrom Nov 20, 2025
Merged
First attempt of fixing elpi syntax by Philip Kaludercic.#847Matafou merged 2 commits intoProofGeneral:masterfrom
Matafou merged 2 commits intoProofGeneral:masterfrom
Conversation
Contributor
Author
|
This is not correct (tests fail) because For instance Lemma false_proof : forall A B : bool, A = B.
Proof.
intros A B.
destruct A.
destruct B.
reflexivity. (*error*)
reflexivity.
Qed. (*test-lemma2*)
when point is on |
Contributor
|
Have you tried binding |
Contributor
Author
|
I will test this. Not sure what this will do with comments though. |
Contributor
|
Pierre Courtieu [2025-11-03 06:33:17] wrote:
A first attempt proposed by @phikal (if I am not mistaken) some years
ago, at supporting the elpi syntax, which can contain the usual
command ender (`. `).
(while (and (setq foundend
(let ((start (point)))
(forward-sexp)
(if (re-search-forward coq-end-command-regexp-forward limit t)
(match-end 1)
(goto-char start))))
As @phikal suggested, you probably want to let-bind
`forward-sexp-function` to nil around the call to `forward-sexp`.
But the above code looks really odd: in one branch of the `if` you just
return a position, while in the other you `goto-char`.
To me, this looks very suspicious (like a kind of type-error), so if
it's really what you intended to do, I suggest you write it as
(if (re-search-forward coq-end-command-regexp-forward limit t)
(match-end 1)
(goto-char start)
start)
to make it crystal clear (and to save the reader from having to
remember what is the return value of `goto-char`).
Nitpick: I'd pass an explicit 1 (and -1 to go backward, rather than use
`backward-sexp` which is designed more as a command than a function) to
`forward-sexp`.
Oh, and one more thing:
(and (not (or (string-equal (match-string 1) ".")
(string-equal (match-string 1) "...")))
This is now a bit dodgy because you use `match-string` after an
`re-search-forward` which may have failed (in which case the match-data
is inherited from the previous successful regexp match, which could be
completely unrelated).
And while you're there: could you replace this `or+equal` with a `member` so
as to allocate the (match-string 1) only once?
|
ad63acb to
78def38
Compare
Contributor
Author
|
A new attempt, with a small refactoring relying more on |
b0bc1cc to
1534895
Compare
1534895 to
74ba7fc
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A first attempt proposed by @phikal (if I am not mistaken) some years ago, at supporting the elpi syntax, which can contain the usual command ender (
.).Example of such syntax: