Re: [HACKERS] Minor bugs and a formatting gripe - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Minor bugs and a formatting gripe
Date
Msg-id 199809040500.BAA01659@candle.pha.pa.us
Whole thread Raw
In response to Minor bugs and a formatting gripe  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Minor bugs and a formatting gripe
List pgsql-hackers
> Bruce mentioned that he'd had some trouble applying my last set of
> patches, because he'd already run his reformatting script against
> the files involved.  So, I took the trouble to grovel through a
> "diff --ignore-all-space" comparison of tonight's cvs tree with what
> I had last week.  (I didn't have the energy to go through the *whole*
> tree, but I did look through all of src/interfaces/.)  It was a
> worthwhile exercise because I found a couple of minor errors --- see
> attached patch.
>
> I was mostly pretty happy with what the formatting script had done with
> the code, especially in libpgtcl which had not been anywhere close to
> matching the formatting conventions of the rest of pgsql.  Nice job!
>
> BUT: I am not happy that the script chooses to reflow block comments.
> Line breaks chosen on the basis of how much fits are not a readability
> improvement over line breaks placed where a human author felt they made
> sense.  For example, is this really an improvement in readability?
> (And if it's *not* a clear gain, why are we doing it?)

Good point.  The way to control this is to use:

    /*--------------
     * bla bla
     *--------------
     */

This will not be reformatted by the system.  When I first ran pgindent,
I checked all the diffs (whew), and found many box comments that had
that format that were not affected.  Other comments got gobbled, and I
backed out the change and added ----- to the comments.  If you see the
indent manual page, you will see a mention of this.

     `Box' comments. Indent assumes that any comment with a dash or star imme-
     diately after the start of comment (that is, `/*-' or `/**') is a comment
     surrounded by a box of stars.  Each line of such a comment is left un-
     changed, except that its indentation may be adjusted to account for the
     change in indentation of the first line of the comment.

So this is the way to preserve comment line numbering, and you will see
the main code does handle this properly, and that other code that does
not have the box gets reformatted as the code changes to look pretty.

Do you still want me to turn it off?

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Minor bugs and a formatting gripe
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Minor bugs and a formatting gripe