1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-11 01:11:31 -07:00

; cperl-mode.el: fix indentation for multiline signatures

This fixes the first (and more important) part of Bug#79269.

* lisp/progmodes/cperl-mode.el (cperl-get-state): Replace
`beginning-of-defun' by `beginning-of-defun-raw'.  Also fix a typo
in the docstring.

* test/lisp/progmodes/cperl-mode-tests.el (test-indentation): Skip
tests unless in cperl-mode.  The test file cperl-indents.erts
explicitly invokes cperl-mode.  Due to different indentation
defaults the tests do not pass in perl-mode.

* test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts: Add
test cperl-subroutine-signatures for Bug#79269
This commit is contained in:
Harald Jörg 2025-08-21 17:52:30 +02:00
parent c04553f655
commit fdf5e5dc41
3 changed files with 30 additions and 2 deletions

View file

@ -98,3 +98,28 @@ Name: cperl-keyword-without-space
my %h = map{$_=>1}
@ARGV;
=-=-=
Name: cperl-subroutine-signatures
=-=
# -*- mode: cperl -*-
# John Ciolfi reported as Bug#79269
use strict;
use warnings;
use experimental 'signatures';
foo(1);
sub foo (
$in1,
$optionsHPtr = {},
$otherOption1 = 1, # Bug: wrong face for this option
) {
my $a = 1; # Bug: should be indented by 2 spaces
# Bug: following are not indented due to use of signatures
my $b = 2;
return $a + $b + $in1;
}
=-=-=

View file

@ -1605,6 +1605,9 @@ It must not be mistaken for \"$)\"."
(forward-line 1))))
(ert-deftest test-indentation ()
;; The erts file explicitly invokes cperl-mode, so skip in perl-mode.
;; Indentation defaults are different, so it won't pass in perl-mode
(skip-unless (eq cperl-test-mode #'cperl-mode))
(ert-test-erts-file (ert-resource-file "cperl-indents.erts")))
;;; cperl-mode-tests.el ends here