GNU bug report logs - #76851
29.4; cperl-mode builtin fcn indent bug and fix

Previous Next

Package: emacs;

Reported by: John Ciolfi <ciolfi <at> mathworks.com>

Date: Sat, 8 Mar 2025 06:10:02 UTC

Severity: normal

Tags: patch

Found in version 29.4

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: John Ciolfi <ciolfi <at> mathworks.com>
Subject: bug#76851: closed (Fixed in the repository: branch emacs-30)
Date: Sun, 09 Mar 2025 16:10:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#76851: 29.4; cperl-mode builtin fcn indent bug and fix

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 76851 <at> debbugs.gnu.org.

-- 
76851: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76851
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Harald Jörg <haj <at> posteo.de>
To: 76851-done <at> debbugs.gnu.org
Subject: Fixed in the repository: branch emacs-30
Date: Sun, 09 Mar 2025 16:09:38 +0000
This is now fixed in the release branch for Emacs and will be
published with the next bugfix release.
-- 
Cheers,
haj

[Message part 3 (message/rfc822, inline)]
From: John Ciolfi <ciolfi <at> mathworks.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 29.4; cperl-mode builtin fcn indent bug and fix
Date: Sat, 8 Mar 2025 01:07:24 -0500
[Message part 4 (text/plain, inline)]
Hi

Given this perl file:

    sub test {
        exec '/bin/echo',
            'Your arguments are: ', @ARGV;
    }
    
    sub exec_fcn {
    }
    
        sub other {
        }

The 'sub other' is indented incorrectly (and all code following it).

The fix is in cperl-after-block-and-statement-beg to not match exec_, i.e. we should
not treat exec_fcn as a builtin. Attached is the fix.

Thanks,
John

[cperl-mode-builtin-fix.patch (text/x-diff, inline)]
--- a/cperl-mode.el
+++ b/cperl-mode.el
@@ -5606,8 +5606,16 @@ Do not look before LIM."
 	 (progn
 	   (forward-sexp -1)
 	   (not
+            ;; Used to indent functions like:
+            ;;    exec 'prog',
+            ;;        @ARGS;
+            ;; [[:space:]] means we will not match exec_fcn and 'sub other' is indented correctly:
+            ;;    sub exec_fcn {
+            ;;    }
+            ;;    sub other {
+            ;;    }
 	    (looking-at
-	     "\\(map\\|grep\\|say\\|printf?\\|system\\|exec\\|tr\\|s\\)\\>")))))))
+	     "\\(map\\|grep\\|say\\|printf?\\|system\\|exec\\|tr\\|s\\)[[:space:]]")))))))
 
 
 (defun cperl-indent-exp ()
[ATT00001 (text/plain, attachment)]

This bug report was last modified 77 days ago.

Previous Next


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