Subject: Re: bug#79271: 30.1; cperl-mode regexp indent issue

From: Harald Jörg <[email-masked]>
Date: Wed, 20 Aug 2025 17:34:51 +0000

Eli Zaretskii <[email-masked]> writes:

>> From: John C <[email-masked]>
>> Date: Tue, 19 Aug 2025 13:43:14 -0400
>> 
>> 1. In a temporary directory, say ~/tmp/, get latest cperl-mode.el from
>>    https://github.com/emacs-mirror/emacs/blob/master/lisp/progmodes/cperl-mode.el
>>    I used the Jul-28-2025 version
>>   
>> https://github.com/emacs-mirror/emacs/blob/cef4302d309e26c2191821ba998518fb89fff54e/lisp/progmodes/cperl-mode.el
>> 
>> 
>> 2. cd ~/tmp
>> 
>> 3. emacs -Q -L .           # Using emacs 30.1
>> 
>> 4. M-x byte-compile-file RET cperl-mode.el RET
>> 
>> 5. C-x C-f foo.pl
>> 
>>    C-x h   # select all of foo.pl
>>    C-M-\   # indent foo.pl
>> 
>> Here's the indented foo.pl:
>> 
>> # -*- mode: cperl -*-
>> my $str =~ s/^
>>     (Field1: [^\n]+) \s*
>>   Field2: \s* (\S+) \s*
>>             //xsm;
>> 
>> Notice that the regexp is not indented nicely. I would expect "Field2 ..." to be aligned under
>> "(Field...)":
>> 
>>   my $str =~ s/^
>>                (Field1: [^\n]+) \s*
>>                Field2: \s* (\S+) \s*
>>                //xsm;
>
> And this one, too.

Another very good recipe (and future test case), thanks!

I'll fix that too (hopefully).  cperl-mode wrongly indents "Field2:" as
a label.
-- 
Cheers,
haj