From: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
To: Noah Misch <noah@leadboat.com>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: emacs configuration for new perltidy settings
Date: Tue, 8 Jan 2019 08:17:43 -0500
Message-ID: <6c5e6da6-5c15-47ff-296f-610fcc977cfd@2ndQuadrant.com> (raw)
In-Reply-To: <20190103055355.GB267595@gust.leadboat.com>
References: <1342042526.2712.21.camel@vanquo.pezone.net>
<20190103055355.GB267595@gust.leadboat.com>
On 1/3/19 12:53 AM, Noah Misch wrote:
> On Thu, Jul 12, 2012 at 12:35:26AM +0300, Peter Eisentraut wrote:
>> This might be useful for some people. Here is an emacs configuration
>> for perl-mode that is compatible with the new perltidy settings. Note
>> that the default perl-mode settings produce indentation that will be
>> completely shredded by the new perltidy settings.
>>
>> (defun pgsql-perl-style ()
>> "Perl style adjusted for PostgreSQL project"
>> (interactive)
>> (setq tab-width 4)
>> (setq perl-indent-level 4)
>> (setq perl-continued-statement-offset 4)
>> (setq perl-continued-brace-offset 4)
> (Later, commit 56fb890 changed perl-continued-statement-offset to 2.) This
> indents braces (perltidy aligns the brace with "if", but perl-mode adds
> perl-continued-statement-offset + perl-continued-brace-offset = 6 columns):
>
> if (-s "src/backend/snowball/stopwords/$lang.stop")
> {
> $stop = ", StopWords=$lang";
> }
>
> If I run perltidy on 60d9979, then run perl-mode indent, the diff between the
> perltidy run and perl-mode indent run is:
> 129 files changed, 8468 insertions(+), 8468 deletions(-)
> If I add (perl-continued-brace-offset . -2):
> 119 files changed, 3515 insertions(+), 3515 deletions(-)
> If I add (perl-indent-continued-arguments . 4) as well:
> 86 files changed, 2626 insertions(+), 2626 deletions(-)
> If I add (perl-indent-parens-as-block . t) as well:
> 65 files changed, 2373 insertions(+), 2373 deletions(-)
>
> That's with GNU Emacs 24.5.1. Versions 24.3.1 and 21.4.1 show similar trends,
> though 21.4.1 predates perl-indent-continued-arguments and
> perl-indent-parens-as-block.
>
> I'm attaching the patch to make it so, along with a patch that illustrates my
> testing method. "sh reindent-perl.sh" will test emacs.samples using your
> Emacs installation. (I don't plan to push the testing patch.)
Sounds good. What do the remaining diffs look like?
cheers
andrew
--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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: andrew.dunstan@2ndquadrant.com, noah@leadboat.com, peter_e@gmx.net
Subject: Re: emacs configuration for new perltidy settings
In-Reply-To: <6c5e6da6-5c15-47ff-296f-610fcc977cfd@2ndQuadrant.com>
* 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