PG icon indicating copy to clipboard operation
PG copied to clipboard

Support ssreflect-style indentation

Open ejgallego opened this issue 9 years ago • 10 comments

Dear PG devs,

it would be great if proofgeneral coq could support ssreflect's style indentation.

In order to maximize horizontal proof space, the ssreflect library uses a more conservative indentation, for instance, this is typical code:

Section A.

Lemma a : P.
Proof.
case/orP=> ...
  by rewrite U.
exact: Pm.
Qed.

End A.

AFAICT, the current recommendation is to disable indentation which is a pity. IMHO we could:

  • have an explicit variable use-ssreflect-indent.
  • automatically detect the import of ssreflect and switch the variable on.

I would be happy to try to provide a patch if the PG devs agree on how they would like this feature to be integrated.

Thanks, Emilio

ejgallego avatar Feb 15 '16 23:02 ejgallego

I think this is what you are looking for:

(setq coq-indent-proofstart 0) (setq coq-indent-modulestart 0)

Please confirm before I close the bug.

Indeed this was asked by another ssreflect guy.

Be careful that ssreflect bullets may not be indented as you want.

Best, P.

Matafou avatar Feb 15 '16 23:02 Matafou

Hi @Matafou , thanks, indeed I saw that advice in the mailing list some time ago. I'll check if the settings are enough.

IMHO it would be great to document the setting before closing the bug, if a specified switch is not desired.

E.

ejgallego avatar Feb 15 '16 23:02 ejgallego

IIRC ssreflect already distributes a lisp file with a number of PG settings (like extra tactics to highlight). Should these be added there?

cpitclaudel avatar Feb 16 '16 04:02 cpitclaudel

Hi @cpitclaudel , the file is this one:

https://github.com/math-comp/math-comp/blob/master/mathcomp/ssreflect/pg-ssr.el

It seems that at least part of it has already been merged, and it doesn't include documentation. I need to submit a patch to math comp for fixing their docs.

I'm currently testing @Matafou settings, will report back and close the bug if appropriate soon.

ejgallego avatar Feb 16 '16 08:02 ejgallego

Hi, I have been testing this and so far looks good.

There is a small tweak to do thou, IMO both variables should be buffer local, to allow both styles to coexists. I should get a patch ready soon.

ejgallego avatar Feb 17 '16 17:02 ejgallego

Agreed, buffer local would be cool.

But how would you set it? Each time you open a file? Pretty painful. This is typically a setting that should be set by a .dir-locals.el written by library authors to enforce a homogeneous style in each library. That would become buffer local this way. And if one wants to set it really buffer per buffer then it should be set by a file variable.

Do you have something better in mind?

P.

Matafou avatar Mar 09 '16 17:03 Matafou

Sounds good! I hope to have time in the next couple of weeks to test something like that.

ejgallego avatar Mar 09 '16 22:03 ejgallego

(setq coq-indent-proofstart 0) (setq coq-indent-modulestart 0)

Those settings do not seem to work in the current master branch of PG. Is there anyone who can confirm it?

pi8027 avatar Oct 27 '21 17:10 pi8027

I confirm. It got removed in the refactoring of indentation. I will put this back quickly. Sorry for the inconvenience.

Matafou avatar Oct 28 '21 19:10 Matafou

By the way is this still open? Do we want these variables buffer local?

Matafou avatar Oct 28 '21 19:10 Matafou