Re: Emacs vs pg_indent's weird indentation for function declarations - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: Emacs vs pg_indent's weird indentation for function declarations
Date
Msg-id CAEepm=0UtAPN2RChs7=pOqHm2uvbU6Px7vfyvt8_-eiP7=ozUg@mail.gmail.com
Whole thread Raw
In response to Re: Emacs vs pg_indent's weird indentation for function declarations  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Emacs vs pg_indent's weird indentation for function declarations
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: "repliation" as database name
Next
From: Michael Paquier
Date:
Subject: Re: pg_basebackup, walreceiver and wal_sender_timeout