Skip to content

Commit 384483e

Browse files
committed
; cperl-mode.el: Indent labels only in code (Bug#79271)
* lisp/progmodes/cperl-mode.el (cperl-indent-line): Make sure that labels are indented in code only * test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts: Two new testcases for non-indentable "labels" in a regex pattern and a qw list
1 parent 6571b63 commit 384483e

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

lisp/progmodes/cperl-mode.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2726,6 +2726,7 @@ PARSE-DATA is used to save status between calls in a loop."
27262726
(if (listp indent) (setq indent (car indent)))
27272727
(cond ((and (looking-at (rx (sequence (eval cperl--label-rx)
27282728
(not (in ":")))))
2729+
(null (get-text-property (point) 'syntax-type))
27292730
(not (looking-at (rx (eval cperl--false-label-rx)))))
27302731
(and (> indent 0)
27312732
(setq indent (max cperl-min-label-indent

test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,25 @@ sub foo (
123123
return $a + $b + $in1;
124124
}
125125
=-=-=
126+
127+
Name: cperl-false-label-in-regex
128+
129+
=-=
130+
# -*- mode: cperl -*-
131+
# John Ciolfi reported as Bug#79271
132+
my $str =~ s/^
133+
(Field1: [^\n]+) \s*
134+
Field2: \s* (\S+) \s*
135+
//xsm;
136+
=-=-=
137+
138+
Name: cperl-false-label-in-qw
139+
140+
=-=
141+
# Related to cperl-false-label-in-regex / Bug#79271
142+
my @chunks = qw(
143+
sub
144+
LABEL:
145+
more words
146+
);
147+
=-=-=

0 commit comments

Comments
 (0)