unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#64364: 30.5; cperl-mode: Bad indentation for subroutine attrs / signatures
@ 2023-06-30 12:56 Harald Jörg
  2023-07-01 20:26 ` bug#64364: Indentation of subroutine signatures has been fixed in the repository Harald Jörg
  0 siblings, 1 reply; 2+ messages in thread
From: Harald Jörg @ 2023-06-30 12:56 UTC (permalink / raw)
  To: 64364

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





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

* bug#64364: Indentation of subroutine signatures has been fixed in the repository.
  2023-06-30 12:56 bug#64364: 30.5; cperl-mode: Bad indentation for subroutine attrs / signatures Harald Jörg
@ 2023-07-01 20:26 ` Harald Jörg
  0 siblings, 0 replies; 2+ messages in thread
From: Harald Jörg @ 2023-07-01 20:26 UTC (permalink / raw)
  To: 64364-done

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





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

end of thread, other threads:[~2023-07-01 20:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30 12:56 bug#64364: 30.5; cperl-mode: Bad indentation for subroutine attrs / signatures Harald Jörg
2023-07-01 20:26 ` bug#64364: Indentation of subroutine signatures has been fixed in the repository 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).