pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Emacs vs pg_indent's weird indentation for function declarations
Date: Mon, 28 Jan 2019 00:28:30 -0500
Message-ID: <7659.1548653310@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEepm=0P3FeTXRcU5B2W3jv3PgRVZ-kGUXLGfd42FFhUROO3ug@mail.gmail.com>
References: <CAEepm=0P3FeTXRcU5B2W3jv3PgRVZ-kGUXLGfd42FFhUROO3ug@mail.gmail.com>

Thomas Munro <thomas.munro@enterprisedb.com> writes:
> For a while I've been baffled by that: the first arguments of later
> lines don't line up with that of the first line, but they're also not
> in a constant column (it varies from function to function), and it's
> also not caused by 8-space vs 4-space confusion.  It was only when I
> put those two things next to each other just now in this email that I
> finally spotted the logic it's using: if you remove "extern int " then
> the later lines line up with the first argument of the top line.  This
> works for other examples I looked at too.  Huh.

Yeah.  I suspect that the underlying cause is that pgindent doesn't
really distinguish function declarations from definitions, at least
not when it comes time to indent the lines after the first one.

> 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 ...

			regards, tom lane




view thread (15+ messages)  latest in thread

Message-ID: <7659.1548653310@sss.pgh.pa.us>
Permalink:  ../7659.1548653310@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7659.1548653310@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, thomas.munro@enterprisedb.com
  Subject: Re: Emacs vs pg_indent's weird indentation for function declarations
  In-Reply-To: <7659.1548653310@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox