aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/progmodes
diff options
context:
space:
mode:
authorHarald Jörg2025-08-21 17:52:30 +0200
committerHarald Jörg2025-08-21 17:52:30 +0200
commitfdf5e5dc415ef692e86f34c7eb4f7fa5bd9b18cb (patch)
tree1645a25adcc589e71b4e64d63e092ef5532ff71d /test/lisp/progmodes
parentc04553f655a05810f02dd77dac4f544018158e94 (diff)
downloademacs-fdf5e5dc415ef692e86f34c7eb4f7fa5bd9b18cb.tar.gz
emacs-fdf5e5dc415ef692e86f34c7eb4f7fa5bd9b18cb.zip
; 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
Diffstat (limited to 'test/lisp/progmodes')
-rw-r--r--test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts25
-rw-r--r--test/lisp/progmodes/cperl-mode-tests.el3
2 files changed, 28 insertions, 0 deletions
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
98my %h = map{$_=>1} 98my %h = map{$_=>1}
99 @ARGV; 99 @ARGV;
100=-=-= 100=-=-=
101
102Name: cperl-subroutine-signatures
103
104=-=
105# -*- mode: cperl -*-
106# John Ciolfi reported as Bug#79269
107use strict;
108use warnings;
109use experimental 'signatures';
110
111foo(1);
112
113sub foo (
114 $in1,
115 $optionsHPtr = {},
116 $otherOption1 = 1, # Bug: wrong face for this option
117 ) {
118
119 my $a = 1; # Bug: should be indented by 2 spaces
120
121 # Bug: following are not indented due to use of signatures
122 my $b = 2;
123 return $a + $b + $in1;
124}
125=-=-=
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 \"$)\"."
1605 (forward-line 1)))) 1605 (forward-line 1))))
1606 1606
1607(ert-deftest test-indentation () 1607(ert-deftest test-indentation ()
1608 ;; The erts file explicitly invokes cperl-mode, so skip in perl-mode.
1609 ;; Indentation defaults are different, so it won't pass in perl-mode
1610 (skip-unless (eq cperl-test-mode #'cperl-mode))
1608 (ert-test-erts-file (ert-resource-file "cperl-indents.erts"))) 1611 (ert-test-erts-file (ert-resource-file "cperl-indents.erts")))
1609 1612
1610;;; cperl-mode-tests.el ends here 1613;;; cperl-mode-tests.el ends here