diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 8643b69ef83..1e2aca73161 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -2766,7 +2766,7 @@ PARSE-DATA is used to save status between calls in a loop." START is a good place to start parsing, or equal to PARSE-START if preset. STATE is what is returned by `parse-partial-sexp'. -DEPTH is true is we are immediately after end of block +DEPTH is true if we are immediately after end of block which contains START. PRESTART is the position basing on which START was found. START-STATE should be a good guess for the start of a function." @@ -2775,7 +2775,7 @@ START-STATE should be a good guess for the start of a function." (if (and parse-start (<= parse-start start-point)) (goto-char parse-start) - (beginning-of-defun) + (beginning-of-defun-raw) (when (cperl-declaration-header-p (point)) (goto-char (cperl-beginning-of-property (point) 'syntax-type)) (beginning-of-line)) diff --git a/test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts b/test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts index ab00e9ce6d4..3a779442a8a 100644 --- a/test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts +++ b/test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts @@ -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; +} +=-=-= diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index 00116986b4b..469345e74c9 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -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