Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pqJHl-0005im-32 for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Apr 2023 19:52:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pqJHj-0005bg-MV for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Apr 2023 19:52:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pqJHj-0005bN-Cn for pgsql-hackers@lists.postgresql.org; Sat, 22 Apr 2023 19:52:39 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pqJHf-001Jtv-GQ for pgsql-hackers@postgresql.org; Sat, 22 Apr 2023 19:52:37 +0000 Received: (Authenticated sender: adsend@dunslane.net) by mail.gandi.net (Postfix) with ESMTPSA id AC8911C0002; Sat, 22 Apr 2023 19:52:25 +0000 (UTC) Content-Type: multipart/alternative; boundary="------------euI0MgHcgCL0mNh09NoUqh1J" Message-ID: Date: Sat, 22 Apr 2023 15:52:24 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: run pgindent on a regular basis / scripted manner Content-Language: en-US To: Tom Lane Cc: Jelte Fennema , "shiy.fnst@fujitsu.com" , Robert Haas , Justin Pryzby , Andres Freund , Noah Misch , Peter Geoghegan , Bruce Momjian , Magnus Hagander , Alvaro Herrera , Stephen Frost , Jesse Zhang , "pgsql-hackers@postgresql.org" , Peter Eisentraut References: <3d67bc80-4de2-5ba8-e272-e4ad2e59ba04@dunslane.net> <4ac8f263-f1bb-faa5-a307-1fffe00f0e3e@dunslane.net> <0f074818-b01a-799f-3c74-5fb5deab1d23@dunslane.net> <1d66447e-a77b-ca0d-90a0-782800e85383@dunslane.net> <3665234.1682174388@sss.pgh.pa.us> <3679607.1682177828@sss.pgh.pa.us> From: Andrew Dunstan In-Reply-To: <3679607.1682177828@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------euI0MgHcgCL0mNh09NoUqh1J Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2023-04-22 Sa 11:37, Tom Lane wrote: > Andrew Dunstan writes: >> On 2023-04-22 Sa 10:39, Tom Lane wrote: >>> Another obstacle in the way of (1) is that there was some discussion >>> of changing perltidy version and/or options. But I don't believe >>> we have a final proposal on that, much less committed code. >> Well, I posted a fairly concrete suggestion with an example patch >> upthread at >> >> I still think that's worth doing. > OK, so plan is (a) update perltidyrc to add --valign-exclusion-list, > (b) adjust pgindent/README to recommend perltidy version 20221112. > > Questions: > > * I see that there's now a 20230309 release, should we consider that > instead? A test I just ran gave identical results to those from 20221112 > > * emacs.samples provides pgsql-perl-style that claims to match > perltidy's rules. Does that need any adjustment? I don't see > anything in it that looks relevant, but I'm not terribly familiar > with emacs' Perl formatting options. At least w.r.t. the vertical alignment issue, AFAICT the emacs style does not attempt to align anything vertically except the first non-space thing on the line. So if anything, by abandoning a lot of vertical alignment it would actually be closer to what the sample emacs style does. The great advantage of not doing this alignment is that there is far less danger of perltidy trying to realign lines that have not in fact changed, because some nearby line has changed. So we'd have a good deal less pointless churn. cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com --------------euI0MgHcgCL0mNh09NoUqh1J Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit


On 2023-04-22 Sa 11:37, Tom Lane wrote:
Andrew Dunstan <andrew@dunslane.net> writes:
On 2023-04-22 Sa 10:39, Tom Lane wrote:
Another obstacle in the way of (1) is that there was some discussion
of changing perltidy version and/or options.  But I don't believe
we have a final proposal on that, much less committed code.

      
Well, I posted a fairly concrete suggestion with an example patch 
upthread at
<https://www.postgresql.org/message-id/47011581-ddec-1a87-6828-6edfabe6b7b6%40dunslane.net>
I still think that's worth doing.
OK, so plan is (a) update perltidyrc to add --valign-exclusion-list,
(b) adjust pgindent/README to recommend perltidy version 20221112.

Questions:

* I see that there's now a 20230309 release, should we consider that
instead?


A test I just ran gave identical results to those from 20221112



* emacs.samples provides pgsql-perl-style that claims to match
perltidy's rules.  Does that need any adjustment?  I don't see
anything in it that looks relevant, but I'm not terribly familiar
with emacs' Perl formatting options.


At least w.r.t. the vertical alignment issue, AFAICT the emacs style does not attempt to align anything vertically except the first non-space thing on the line. So if anything, by abandoning a lot of vertical alignment it would actually be closer to what the sample emacs style does.

The great advantage of not doing this alignment is that there is far less danger of perltidy trying to realign lines that have not in fact changed, because some nearby line has changed. So we'd have a good deal less pointless churn.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com
--------------euI0MgHcgCL0mNh09NoUqh1J--