Re: Emacs vs pg_indent's weird indentation for function declarations
Thomas Munro <thomas.munro@enterprisedb.com>
From: Thomas Munro <thomas.munro@enterprisedb.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2019-01-28T08:47:14Z
Lists: pgsql-hackers
Attachments
- hack-pgindent.patch (application/octet-stream) patch
On Mon, Jan 28, 2019 at 8:08 PM Michael Paquier <michael@paquier.xyz> wrote: > On Mon, Jan 28, 2019 at 12:28:30AM -0500, Tom Lane wrote: > > Thomas Munro <thomas.munro@enterprisedb.com> writes: > >> That's ... annoying. I wish indent wouldn't do that, because it means > >> that my declarations get moved around every time I write code. > > > > If you can fix it, I'd vote for accepting the patch. I don't personally > > have the desire to dig into the indent code that much ... > > If you could get pgindent smarter in this area, it would be really > nice.. Ah, it's not indent doing it, it's pgindent's post_indent subroutine trying to correct the effects of the (implied) -psl option, but not doing a complete job of it (it should adjust the indentation lines of later lines if it changes the first line). One idea I had was to tell indent not to do that by using -npsl when processing headers, like in the attached. That fixes all the headers I looked at, though of course it doesn't fix the static function declarations that appear in .c files, so it's not quite the right answer. -- Thomas Munro http://www.enterprisedb.com
Commits
-
Phase 2 pgindent run for v12.
- 8255c7a5eeba 12.0 landed
-
ANSI-ify a few straggler K&R-style function definitions.
- da71f98efba9 12.0 landed