GNU bug report logs - #79271
30.1; cperl-mode regexp indent issue

Previous Next

Package: emacs;

Reported by: John C <john.ciolfi.32 <at> gmail.com>

Date: Tue, 19 Aug 2025 17:44:02 UTC

Severity: normal

Found in version 30.1

Done: Harald Jörg <haj <at> posteo.de>

Full log


Message #11 received at 79271 <at> debbugs.gnu.org (full text, mbox):

From: Harald Jörg <haj <at> posteo.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79271 <at> debbugs.gnu.org, John C <john.ciolfi.32 <at> gmail.com>
Subject: Re: bug#79271: 30.1; cperl-mode regexp indent issue
Date: Wed, 20 Aug 2025 17:34:51 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: John C <john.ciolfi.32 <at> gmail.com>
>> 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




This bug report was last modified 20 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.