Re: Emacs vs pg_indent's weird indentation for function declarations

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Emacs vs pg_indent's weird indentation for function declarations
Date: 2019-01-28 08:47:14
Message-ID: CAEepm=0UtAPN2RChs7=pOqHm2uvbU6Px7vfyvt8_-eiP7=ozUg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 28, 2019 at 8:08 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> On Mon, Jan 28, 2019 at 12:28:30AM -0500, Tom Lane wrote:
> > Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)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

Attachment Content-Type Size
hack-pgindent.patch application/octet-stream 1.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-01-28 09:25:10 Re: pg_basebackup, walreceiver and wal_sender_timeout
Previous Message Kyotaro HORIGUCHI 2019-01-28 08:30:57 Re: "repliation" as database name