unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8165: 24.0.50; cperl indentation
@ 2011-03-03 16:37 Sam Steingold
  2020-09-01 16:22 ` bug#8165: cperl-mode: The wanted indentation is available via customize Harald Jörg
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Steingold @ 2011-03-03 16:37 UTC (permalink / raw)
  To: 8165

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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8165: cperl-mode: The wanted indentation is available via customize
  2011-03-03 16:37 bug#8165: 24.0.50; cperl indentation Sam Steingold
@ 2020-09-01 16:22 ` Harald Jörg
  2020-09-01 17:12   ` Stefan Kangas
  0 siblings, 1 reply; 4+ messages in thread
From: Harald Jörg @ 2020-09-01 16:22 UTC (permalink / raw)
  To: 8165

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







^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8165: cperl-mode: The wanted indentation is available via customize
  2020-09-01 16:22 ` bug#8165: cperl-mode: The wanted indentation is available via customize Harald Jörg
@ 2020-09-01 17:12   ` Stefan Kangas
  2020-09-01 18:15     ` Harald Jörg
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Kangas @ 2020-09-01 17:12 UTC (permalink / raw)
  To: Harald Jörg, 8165-done

Harald Jörg <haj@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8165: cperl-mode: The wanted indentation is available via customize
  2020-09-01 17:12   ` Stefan Kangas
@ 2020-09-01 18:15     ` Harald Jörg
  0 siblings, 0 replies; 4+ messages in thread
From: Harald Jörg @ 2020-09-01 18:15 UTC (permalink / raw)
  To: 8165, stefankangas, sds

On 9/1/20 7:12 PM, Stefan Kangas wrote:
> Harald Jörg <haj@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-01 18:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-03 16:37 bug#8165: 24.0.50; cperl indentation Sam Steingold
2020-09-01 16:22 ` bug#8165: cperl-mode: The wanted indentation is available via customize Harald Jörg
2020-09-01 17:12   ` Stefan Kangas
2020-09-01 18:15     ` Harald Jörg

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).