Skip to content

Conversation

@Matafou
Copy link
Contributor

@Matafou Matafou commented Nov 3, 2025

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:

From elpi Require Import elpi.

Elpi Tactic show.
Elpi Accumulate lp:{{

  solve (goal Ctx _Trigger Type Proof _) _ :-
    coq.say "Goal:" Ctx "|-" Proof ":" Type.

}}.

@Matafou
Copy link
Contributor Author

Matafou commented Nov 3, 2025

This is not correct (tests fail) because forward-sexp is redefined in proof-general and might jump over whole bunches of commands.

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 Proof and we eval forward-sexp we end up after the Qed.

@phikal
Copy link
Contributor

phikal commented Nov 3, 2025

Have you tried binding forward-sexp-function to nil, so that PG doesn't use the SMIE interpretation of Sexps, but falls back to the default (which should just do counting for opening and closing symbols)?

@Matafou
Copy link
Contributor Author

Matafou commented Nov 3, 2025

I will test this. Not sure what this will do with comments though.

@monnier
Copy link
Contributor

monnier commented Nov 4, 2025 via email

@Matafou
Copy link
Contributor Author

Matafou commented Nov 4, 2025

A new attempt, with a small refactoring relying more on syntax-ppss than before.
There are still a strange behavior of coq-script-parse-cmdend-forward/backqard wrt to bullets and {, }, but no more than before. So for now I will experiment with this.

@Matafou Matafou force-pushed the fix-elpi-parsing branch 2 times, most recently from 8048a86 to b0bc1cc Compare November 5, 2025 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants