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

Prolog source layout #186

Closed
JanWielemaker opened this issue Dec 13, 2016 · 10 comments
Closed

Prolog source layout #186

JanWielemaker opened this issue Dec 13, 2016 · 10 comments

Comments

@JanWielemaker
Copy link
Member

According to https://arxiv.org/pdf/0911.2899.pdf, the preferred layout for Prolog is to indent clause bodies with 4 and use spaces. I'm in favour of changing to this indentation and update the default settings for PceEmacs accordingly.

To facilitate this I wrote a Prolog program to convert the current layout reliably. I exploits the library prolog_colour to created a detailed annotated parse tree. How to make this available?

Possibly additional transformations:

  • Move the cut (!) to its own line?
@JanWielemaker JanWielemaker added this to the 7.4.0 milestone Dec 13, 2016
@triska
Copy link
Member

triska commented Dec 13, 2016

Spaces: +1.

@edechter
Copy link
Contributor

Move cut to its own line: +1

@edechter
Copy link
Contributor

@JanWielemaker What is it exactly that you want to make available?

@JanWielemaker
Copy link
Member Author

I probably want to make the re-indenter available for people who used the old SWI-Prolog layout and want to migrate to the new. Most likely as a pack.

@JanWielemaker
Copy link
Member Author

This is all done. See https://github.com/JanWielemaker/reindent

@TeamSPoon
Copy link
Contributor

TeamSPoon commented Jan 9, 2017 via email

@JanWielemaker
Copy link
Member Author

Yes. Well, it works quite ok provided you used the previous SWI-Prolog style. If rewrites that style
rather than creating an indentation from scratch.

@triska
Copy link
Member

triska commented Jan 9, 2017

One example where the indentation of a comment broke:

SWI-Prolog/packages-ssl@6608d61#diff-08cee23742245590436e7e17427f44a2

Please see line 51 of client.pl in this commit.

@Anniepoo
Copy link
Member

Anniepoo commented Jan 29, 2017 via email

@JanWielemaker
Copy link
Member Author

See https://github.com/JanWielemaker/reindent
The main program is swi-indent.pl. Adjust paths and run swi-indent.pl --help for basic usage. By default it works in place, so make sure you have checked in your file prior to converting it so you can
go back.

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

No branches or pull requests

5 participants