bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#64364: 30.5; cperl-mode: Bad indentation for subroutine attrs / sign


From: Harald Jörg
Subject: bug#64364: 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]