]> git.eshelyaron.com Git - emacs.git/commit
cperl-mode.el: Support subroutine signatures
authorHarald Jörg <haj@posteo.de>
Fri, 30 Jun 2023 21:41:06 +0000 (23:41 +0200)
committerHarald Jörg <haj@posteo.de>
Fri, 30 Jun 2023 21:41:06 +0000 (23:41 +0200)
commita7ff8a76a52d316b27f05cd1267fe94cea9f35d1
treed767d5ff79405a6fb4066c20592f4e88faef318e
parent361bf8a1132724516bf7e01d5f91510ffec83991
cperl-mode.el: Support subroutine signatures

Since Perl 5.20, subroutine signatures were available as an
experimental feature.  With Perl 5.38, they will be always enabled in
the new object system.

* test/lisp/progmodes/cperl-mode-resources/cperl-bug-64190.pl:
* test/lisp/progmodes/cperl-mode-resources/cperl-bug-64364.pl: New
test resources.

* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test-fontify-attrs-and-signatures): Add tests for
signatures.
(cperl-test-attribute-rx, cperl-test-attribute-list-rx)
(cperl-test-prototype-rx, cperl-test-signature-rx): Tests for the
new rx sequences.
(cperl-test-bug-64190): New test for multiline declarations.
(cperl-test-bug-64364): New test for indentation of declarations.

* lisp/progmodes/cperl-mode.el:
(toplevel): New rx sequences to match Perl variables and attributes.
(cperl-declaration-header-p): New function to identify declarations.
(cperl-block-declaration-p): Use the new function.
(cperl-mode): Use the rx sequences.
(cperl-get-state): Use the new function.
(cperl-sniff-for-indent): Use the new function.
(cperl-find-sub-attrs): Improve fontification of subroutine
prototypes and attributes while typing when jit-lock-mode is
active.  Detect signatures, and distinguish them from prototypes.
(cperl-find-pods-heres): Use the rx sequences to detect subroutines.
(cperl-init-faces): Use the rx sequences for fontification.
lisp/progmodes/cperl-mode.el
test/lisp/progmodes/cperl-mode-resources/cperl-bug-64190.pl [new file with mode: 0644]
test/lisp/progmodes/cperl-mode-resources/cperl-bug-64364.pl [new file with mode: 0644]
test/lisp/progmodes/cperl-mode-tests.el