Subject: bug#76851: closed (Fixed in the repository: branch emacs-30)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 09 Mar 2025 16:10:02 +0000

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 [email-masked].

-- 
76851: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76851
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Fixed in the repository: branch emacs-30
From: Harald Jörg <[email-masked]>
To: [email-masked]
Date: Sun, 09 Mar 2025 16:09:38 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

This is now fixed in the release branch for Emacs and will be
published with the next bugfix release.
-- 
Cheers,
haj

Subject: 29.4; cperl-mode builtin fcn indent bug and fix
From: John Ciolfi <[email-masked]>
To: <[email-masked]>
Date: Sat, 8 Mar 2025 01:07:24 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

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

--- 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 ()