--- Begin Message ---
Subject: |
30.5; cperl-mode: Bad indentation for subroutine attrs / signatures |
Date: |
Fri, 30 Jun 2023 12:56:11 +0000 |
Owner: haj@posteo.de
Since Perl 5.20, Perl subroutines can be declared with signatures.
When subroutine signatures are written in a line of their own,
indentation in cperl-mode gets it wrong.
Example: This is how it should look like (All examples
with cperl-indentation-style set to "PBP"), and also
how perl-mode indents it:
--------------------------------------------------
package P {
sub way { ...; }
sub bus
:lvalue
($sig,$na,@ture)
{
...;
}
}
--------------------------------------------------
This is how it is indented when I mark the whole buffer and call
<M-x> indent-region. The subroutine attribute and signature should be
indented as continuation lines, but they aren't.
--------------------------------------------------
package P {
sub way { ...; }
sub bus
:lvalue
($sig,$na,@ture)
{
...;
}
}
--------------------------------------------------
This is how it is indented when I indent every single line with <TAB>
(which runs `cperl-indent-command'). The code block of the subroutine
and everything up to the closing brace of the enclosing package is
indented too far.
--------------------------------------------------
package P {
sub way { ...; }
sub bus
:lvalue
($sig,$na,@ture)
{
...;
}
}
--------------------------------------------------
I am working on fixing this, as part of properly supporting subroutine
signatures in cperl-mode. The purpose of this bug report is a
demonstration of the symptoms.
--
Cheers,
haj
--- End Message ---
--- Begin Message ---
Subject: |
Indentation of subroutine signatures has been fixed in the repository. |
Date: |
Sat, 01 Jul 2023 20:26:02 +0000 |
Indentation of Perl code with subroutine signatures has been fixed in
the Emacs master branch. cperl-mode.el as available in the repository
can be used with Emacs 28 and 27 (and could be backported to Emacs 26 if
there is interest).
--
Cheers,
haj
--- End Message ---