Thread: [PATCH] postgresql.conf.sample comment alignment.

[PATCH] postgresql.conf.sample comment alignment.

From
Peter Smith
Date:
This patch tweaks a some tabbing and replaces some spaces with tabs to
improve slightly the comment alignment in file
'postgresql.conf.sample'

PSA.

------
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment

Re: [PATCH] postgresql.conf.sample comment alignment.

From
Tom Lane
Date:
Peter Smith <smithpb2250@gmail.com> writes:
> This patch tweaks a some tabbing and replaces some spaces with tabs to
> improve slightly the comment alignment in file
> 'postgresql.conf.sample'

Hmm ... the parts you want to change generally look OK to me.
I wonder if you are looking at it with tab stops set to 4 spaces
rather than 8 spaces?

While 4 spaces is our convention for C code, postgresql.conf
is going to be edited by end users who almost certainly have their
editors set up for 8 spaces, so it's going to look funny to them
if the comments are aligned on the assumption of 4 spaces.

One idea for avoiding confusion is to legislate that we won't
use tabs at all in this file (which we could enforce via
.gitattributes, I think).  But that might just be making things
equally inconvenient for everybody.

            regards, tom lane



Re: [PATCH] postgresql.conf.sample comment alignment.

From
Peter Smith
Date:
On Tue, Aug 2, 2022 at 10:03 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Peter Smith <smithpb2250@gmail.com> writes:
> > This patch tweaks a some tabbing and replaces some spaces with tabs to
> > improve slightly the comment alignment in file
> > 'postgresql.conf.sample'
>
> Hmm ... the parts you want to change generally look OK to me.
> I wonder if you are looking at it with tab stops set to 4 spaces
> rather than 8 spaces?
>

No. I did fall into that 4/8 trap originally, but I definitely used
:set tapstop=8 when modifying this file.

> While 4 spaces is our convention for C code, postgresql.conf
> is going to be edited by end users who almost certainly have their
> editors set up for 8 spaces, so it's going to look funny to them
> if the comments are aligned on the assumption of 4 spaces.
>
> One idea for avoiding confusion is to legislate that we won't
> use tabs at all in this file (which we could enforce via
> .gitattributes, I think).  But that might just be making things
> equally inconvenient for everybody.
>

------
Kind Regards,
Peter Smith
Fujitsu Australia



Re: [PATCH] postgresql.conf.sample comment alignment.

From
Alvaro Herrera
Date:
On 2022-Aug-01, Tom Lane wrote:

> One idea for avoiding confusion is to legislate that we won't
> use tabs at all in this file (which we could enforce via
> .gitattributes, I think).

+1.

> But that might just be making things equally inconvenient for
> everybody.

In this situation, the only disadvantaged users are those using a
non-fixed-width font in their editor, but those are lost souls already.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"Having your biases confirmed independently is how scientific progress is
made, and hence made our great society what it is today" (Mary Gardiner)



Re: [PATCH] postgresql.conf.sample comment alignment.

From
Michael Paquier
Date:
On Wed, Aug 03, 2022 at 12:58:04PM +0200, Alvaro Herrera wrote:
> On 2022-Aug-01, Tom Lane wrote:
>> One idea for avoiding confusion is to legislate that we won't
>> use tabs at all in this file (which we could enforce via
>> .gitattributes, I think).
>
> +1.

That's not the first time this 4- or 8-character tab issue is popping
up around here, so enforcing spaces and having a rule sounds like a
good idea at the end.

>> But that might just be making things equally inconvenient for
>> everybody.
>
> In this situation, the only disadvantaged users are those using a
> non-fixed-width font in their editor, but those are lost souls already.

Haha.
--
Michael

Attachment

Re: [PATCH] postgresql.conf.sample comment alignment.

From
Julien Rouhaud
Date:
On Thu, Aug 04, 2022 at 10:09:27AM +0900, Michael Paquier wrote:
> On Wed, Aug 03, 2022 at 12:58:04PM +0200, Alvaro Herrera wrote:
> > On 2022-Aug-01, Tom Lane wrote:
> >> One idea for avoiding confusion is to legislate that we won't
> >> use tabs at all in this file (which we could enforce via
> >> .gitattributes, I think).
> >
> > +1.
>
> That's not the first time this 4- or 8-character tab issue is popping
> up around here, so enforcing spaces and having a rule sounds like a
> good idea at the end.

+1



Re: [PATCH] postgresql.conf.sample comment alignment.

From
Peter Smith
Date:
On Thu, Aug 4, 2022 at 11:09 AM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Wed, Aug 03, 2022 at 12:58:04PM +0200, Alvaro Herrera wrote:
> > On 2022-Aug-01, Tom Lane wrote:
> >> One idea for avoiding confusion is to legislate that we won't
> >> use tabs at all in this file (which we could enforce via
> >> .gitattributes, I think).
> >
> > +1.
>
> That's not the first time this 4- or 8-character tab issue is popping
> up around here, so enforcing spaces and having a rule sounds like a
> good idea at the end.
>

Well, it was only assumed that I had probably confused 4- 8- tabs, but
I don't think I did, so the tabbing issue did not really "pop up"
here.

e.g. you can see some of the existing alignments I'd suggested
modifying here [1]
- #shared_preload_libraries = '' # (change requires restart)
- #idle_in_transaction_session_timeout = 0 # in milliseconds, 0 is
disable <- (moved comments of the neighbours to keep them all aligned)
- etc.

I'm not saying replacing the tabs with spaces isn't a good idea - I
also agree probably it is, but that's a different problem to the
alignments I was trying to correct with the patch

------
[1] https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample

Kind Regards,
Peter Smith.
Fujitsu Australia



Re: [PATCH] postgresql.conf.sample comment alignment.

From
Bruce Momjian
Date:
On Thu, Aug  4, 2022 at 12:42:38PM +1000, Peter Smith wrote:
> On Thu, Aug 4, 2022 at 11:09 AM Michael Paquier <michael@paquier.xyz> wrote:
> >
> > On Wed, Aug 03, 2022 at 12:58:04PM +0200, Alvaro Herrera wrote:
> > > On 2022-Aug-01, Tom Lane wrote:
> > >> One idea for avoiding confusion is to legislate that we won't
> > >> use tabs at all in this file (which we could enforce via
> > >> .gitattributes, I think).
> > >
> > > +1.
> >
> > That's not the first time this 4- or 8-character tab issue is popping
> > up around here, so enforcing spaces and having a rule sounds like a
> > good idea at the end.
> >
> 
> Well, it was only assumed that I had probably confused 4- 8- tabs, but
> I don't think I did, so the tabbing issue did not really "pop up"
> here.
> 
> e.g. you can see some of the existing alignments I'd suggested
> modifying here [1]
> - #shared_preload_libraries = '' # (change requires restart)
> - #idle_in_transaction_session_timeout = 0 # in milliseconds, 0 is
> disable <- (moved comments of the neighbours to keep them all aligned)
> - etc.
> 
> I'm not saying replacing the tabs with spaces isn't a good idea - I
> also agree probably it is, but that's a different problem to the
> alignments I was trying to correct with the patch

Patch applied to master.  Perhaps someday we will adjust tabs, but for
now, this is an improvements.  I made a few small adjustments myself.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.



Re: [PATCH] postgresql.conf.sample comment alignment.

From
Peter Smith
Date:
On Tue, Oct 31, 2023 at 11:51 PM Bruce Momjian <bruce@momjian.us> wrote:
>
...
> Patch applied to master.  Perhaps someday we will adjust tabs, but for
> now, this is an improvements.  I made a few small adjustments myself.
>

I had long forgotten this old patch. Thanks for resurrecting it and pushing!

======
Kind Regards,
Peter Smith.
Fujitsu Australia