Re: [HACKERS] Preliminary results for proposed new pgindentimplementation - Mailing list pgsql-hackers

From Piotr Stefaniak
Subject Re: [HACKERS] Preliminary results for proposed new pgindentimplementation
Date
Msg-id VI1PR03MB11990AE83B88CAD06756A27BF2C10@VI1PR03MB1199.eurprd03.prod.outlook.com
Whole thread Raw
In response to Re: [HACKERS] Preliminary results for proposed new pgindent implementation  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Preliminary results for proposed new pgindent implementation
List pgsql-hackers
On 2017-06-17 00:02, Tom Lane wrote:
> Piotr Stefaniak <postgres@piotr-stefaniak.me> writes:
>> On 2017-06-16 21:56, Tom Lane wrote:
>>> Unless Piotr objects, I propose to add another switch to bsdindent
>>> that selects this behavior, and then we can drop entab, removing
>>> another impediment to getting pgindent working.
> 
>> I understand the reasoning, but this is a very specific need and I think
>> not at all universal for anyone else in the future. One of the bugs
>> listed in indent's manpage is that it "has more switches than ls(1)". So
>> currently I'm against pushing an option for the above upstream, to the
>> FreeBSD repository.
> 
>> Why not add this to the already non-empty list of custom patches?
> 
> Umm ... I thought the idea was to get to the point where the list of
> custom patches *is* empty.  Except for carrying our own Makefile of
> course.  I'd be sad if we needed a fork just for this.
> 
> What I'm testing with right now has just four differences from your repo:

There are also the "portability fixes" and they're the main problem.

I've simply removed things like capsicum or __FBSDID() because I thought
it wouldn't be a problem since Postgres will have its own copy of indent
anyway (so that its behavior is not a moving target). I can ifdef-out
them instead of removing entirely, I just didn't think it was important
anymore.

I expect to be in trouble for replacing err() and errx(), though.


> 1. This workaround for what I believe you agree is a bug:
> 
> -        ps.in_decl = ps.decl_on_line = ps.last_token != type_def;
> +        ps.in_decl = ps.decl_on_line = true;

That will need a proper fix...

> 2. The long-lines adjustment I just sent you a patch for.

That looks very good.

> 3. The tab-vs-space difference under discussion here.

I can be convinced to make it another option upstream. But I dislike it
nevertheless.

> 4. A temporary hack affecting the indentation of comments on the same line
> (forcing them to a multiple of 8 spaces even though tabsize is 4).  I have
> every intention of dropping that one later; I just don't want to deal with
> comment reindentation at the same time as these other things.

Great!

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Preliminary results for proposed new pgindent implementation
Next
From: Michael Paquier
Date:
Subject: [HACKERS] Incorrect comment in 001_ssltests.pl