GNU bug report logs - #8165
24.0.50; cperl indentation

Previous Next

Package: emacs;

Reported by: sds <at> gnu.org

Date: Thu, 3 Mar 2011 16:38:01 UTC

Severity: minor

Found in version 24.0.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8165 in the body.
You can then email your comments to 8165 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8165; Package emacs. (Thu, 03 Mar 2011 16:38:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to sds <at> gnu.org:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 03 Mar 2011 16:38:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sam Steingold <sds <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.50; cperl indentation
Date: Thu, 03 Mar 2011 11:37:10 -0500
cperl-mode mis-indents _data_ (as opposed to _code_).
e.g.,

use Class::Struct Foo => [
    a => '$',
    b => '$',
    c => '$',
];

is indented as

use Class::Struct Foo => [
                          a => '$',
                          b => '$',
                          c => '$',
                         ];

which is much less readable.
the same goes for

my $foo = [
    "a",
    "b",
    ("c","d"),
];

I understand that this might be a matter of taste, but it would be nice
if my preferred indentation were also available.

PS. I am aware (and not fond) of the alternative

my $foo =
  [ .... ];


-- 
Sam Steingold (http://sds.podval.org/) on CentOS release 5.3 (Final) X
http://mideasttruth.com http://iris.org.il
http://ffii.org http://memri.org http://pmw.org.il http://www.memritv.org
The paperless office will become a reality soon after the paperless toilet.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#8165; Package emacs. (Tue, 01 Sep 2020 16:23:01 GMT) Full text and rfc822 format available.

Message #8 received at 8165 <at> debbugs.gnu.org (full text, mbox):

From: Harald Jörg <haj <at> posteo.de>
To: 8165 <at> debbugs.gnu.org
Subject: cperl-mode: The wanted indentation is available via customize
Date: Tue, 1 Sep 2020 18:22:19 +0200
The desired indentation of data

use Class::Struct Foo => [
    a => '$',
    b => '$',
    c => '$',
];

is already available.  As so many things in cperl-mode, it can be
customized:

(setq cperl-close-paren-offset -4)
(setq cperl-indent-parens-as-block t)

Therefore I suggest to close this bug.

These are also the recommended settings in the most influential book
Perl Best Practices (PBP) by Damian Conway.  I guess I should add
the PBP settings for indentation in a new value to cperl-style-alist,
but that's probably beyond the scope of this bug report.
-- 
Cheers,
haj






Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Tue, 01 Sep 2020 17:13:01 GMT) Full text and rfc822 format available.

Notification sent to sds <at> gnu.org:
bug acknowledged by developer. (Tue, 01 Sep 2020 17:13:02 GMT) Full text and rfc822 format available.

Message #13 received at 8165-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Harald Jörg <haj <at> posteo.de>, 8165-done <at> debbugs.gnu.org
Subject: Re: bug#8165: cperl-mode: The wanted indentation is available via
 customize
Date: Tue, 1 Sep 2020 10:12:07 -0700
Harald Jörg <haj <at> posteo.de> writes:

> Therefore I suggest to close this bug.

Done.

You can just add -done to the bug number in the address if you would
like to do it yourself next time.  See the To-field of this message.

> These are also the recommended settings in the most influential book
> Perl Best Practices (PBP) by Damian Conway.  I guess I should add
> the PBP settings for indentation in a new value to cperl-style-alist,
> but that's probably beyond the scope of this bug report.

It sounds like a good idea to add such an option.

Just a thought: I seem to remember that the PBP recommendations is the
generally accepted style in the Perl community these days?  Does it make
sense to change that to be the default?  (It's been over 10 years since
I did any serious Perl programming...)

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#8165; Package emacs. (Tue, 01 Sep 2020 18:17:01 GMT) Full text and rfc822 format available.

Message #16 received at 8165 <at> debbugs.gnu.org (full text, mbox):

From: Harald Jörg <haj <at> posteo.de>
To: 8165 <at> debbugs.gnu.org, stefankangas <at> gmail.com, sds <at> gnu.org
Subject: Re: bug#8165: cperl-mode: The wanted indentation is available via
 customize
Date: Tue, 1 Sep 2020 20:15:52 +0200
On 9/1/20 7:12 PM, Stefan Kangas wrote:
> Harald Jörg <haj <at> posteo.de> writes:
> 
>> Therefore I suggest to close this bug.
> 
> Done.
> 
> You can just add -done to the bug number in the address if you would
> like to do it yourself next time.  See the To-field of this message.

Thank you for this hint.  I wasn't aware of that.

>> These are also the recommended settings in the most influential book
>> Perl Best Practices (PBP) by Damian Conway.  I guess I should add
>> the PBP settings for indentation in a new value to cperl-style-alist,
>> but that's probably beyond the scope of this bug report.
> 
> It sounds like a good idea to add such an option.
> 
> Just a thought: I seem to remember that the PBP recommendations is the
> generally accepted style in the Perl community these days?  Does it make
> sense to change that to be the default?  (It's been over 10 years since
> I did any serious Perl programming...)

I would be absolutely fine with making the PBP recommendations the
default.   By now, the book is 13 years old and some of its content
is no longer generally accepted - but as far as I can say, the
indentation rules haven't seen any criticism.  And though Damian is
a vim wizard, his book lists the Emacs variables which match his
recommendations - and it is still available for download from
O'Reilly.

Different indentation styles seem to be also present in perl-mode, but
only in the mode's documentation - there's no command to switch all
variables which customize indentation in one go.  Since the set of
available options is different anyway, I guess I can get away with
adding the new option to cperl-mode only.
-- 
Cheers,
haj




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 Sep 2020 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 202 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.