mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
; 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
This commit is contained in:
parent
6571b632ed
commit
384483e263
2 changed files with 23 additions and 0 deletions
|
|
@ -2726,6 +2726,7 @@ PARSE-DATA is used to save status between calls in a loop."
|
|||
(if (listp indent) (setq indent (car indent)))
|
||||
(cond ((and (looking-at (rx (sequence (eval cperl--label-rx)
|
||||
(not (in ":")))))
|
||||
(null (get-text-property (point) 'syntax-type))
|
||||
(not (looking-at (rx (eval cperl--false-label-rx)))))
|
||||
(and (> indent 0)
|
||||
(setq indent (max cperl-min-label-indent
|
||||
|
|
|
|||
|
|
@ -123,3 +123,25 @@ sub foo (
|
|||
return $a + $b + $in1;
|
||||
}
|
||||
=-=-=
|
||||
|
||||
Name: cperl-false-label-in-regex
|
||||
|
||||
=-=
|
||||
# -*- mode: cperl -*-
|
||||
# John Ciolfi reported as Bug#79271
|
||||
my $str =~ s/^
|
||||
(Field1: [^\n]+) \s*
|
||||
Field2: \s* (\S+) \s*
|
||||
//xsm;
|
||||
=-=-=
|
||||
|
||||
Name: cperl-false-label-in-qw
|
||||
|
||||
=-=
|
||||
# Related to cperl-false-label-in-regex / Bug#79271
|
||||
my @chunks = qw(
|
||||
sub
|
||||
LABEL:
|
||||
more words
|
||||
);
|
||||
=-=-=
|
||||
|
|
|
|||
Loading…
Reference in a new issue