I'm using proof-general to write Coq proofs.
When I use C-c C-n
in a proof, my cursor is moved to the next line, but the current line is not formatted. So for instance, if I type:
intros n. <C-c C-n>
my cursor moves to the next line, but intros n.
remains unindented. So I have to go back up a line, go to the end of the line and hit <RET>
to auto-indent the coq statement. At which point, proof-general
considers that statement changed and I have to re-run it.
Ideally, I would line C-c C-n
to auto-indent the line it is running and to not go to the next line.
How can I make that happen?
You can do what you're describing using advice:
… but I suspect this is an AB problem:
C-c C-n
doesn't insert a newline, so if you're writing proofs you will in fact pressRET
roughly once per time you pressC-c C-n
. If you press it before pressingC-c C-n
, then the line will be properly indented.Worse, you shouldn't typically have an incorrectly indented
intros
in the first place, if you're using the default setup (electric-indent): whichever parent line is causingintros
to need indentation should also cause it to be indented when its line is created.If I misunderstood, please do update the OP with a concrete example of the scenario that leads you to needing this feature, and we can see whether there is already something in PG that might help.