From: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz> |
Subject: | Re: Emacs vs pg_indent's weird indentation for function declarations |
Date: | 2019-05-15 21:26:47 |
Message-ID: | CA+hUKGKb9n8xgWW3uEiA3Txvb9Er-FRX-wAAiiWdAjD7-nN44Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, May 16, 2019 at 9:17 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I wrote:
> > I experimented with fixing this. I was able to get pg_bsd_indent to
> > distinguish multi-line function declarations from definitions, but it
> > turns out that it doesn't help your concern about the lines being too
> > long after re-indenting. Contrary to what you imagine above, it seems
> > pg_bsd_indent will not reflow argument lists, regardless of whether it
> > thinks there needs to be more or less leading whitespace.
>
> Actually, now that I think about it, pgindent seldom revisits line-break
> decisions in code anyway; it's only aggressive about reflowing comments.
> So maybe we shouldn't be expecting it to fix this.
Ahh, so my quick and dirty perl change was probably OK then. Sorry I
didn't realise that before, but this certainly a better way, fixing
the right thing.
> A small problem with the "rejiggering" is that it now makes the wrong
> choice for K&R-style function definitions, causing them to be weirdly
> indented. For our purposes, that's a non-problem so I'm not excited
> about trying to make it smart enough to recognize those. We do have
> a couple of amazingly old and crufty K&R-style functions in src/port/,
> though, so probably we'd wish to fix those.
What kid of fork is pg_bsd_indent... do we care about upstreaming
changes? I guess someone would need to deal with that case eventually
if so.
> Attached is working draft of pg_bsd_indent changes (still sans comments)
> as well as a patch showing the difference between current pgindent
> results on HEAD and the results of this version. I think there's no
> question that this is an improvement.
+1
Thanks for looking into it!
--
Thomas Munro
https://enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-05-15 21:27:28 | Re: ClonedConstraint typedef is dead code? |
Previous Message | Tom Lane | 2019-05-15 21:17:01 | Re: Emacs vs pg_indent's weird indentation for function declarations |