GNU bug report logs - #88
perl-mode - fix syntax of anonymous sub prototypes

Previous Next

Package: emacs;

Reported by: "Giuliano Procida" <giuliano.procida <at> googlemail.com>

Date: Sat, 29 Mar 2008 18:55:11 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (Emacs bug Tracking System)
To: "Giuliano Procida" <giuliano.procida <at> googlemail.com>
Subject: bug#88 closed by Stefan Monnier <monnier <at> IRO.UMontreal.CA> (Re: 
 perl-mode - fix syntax of anonymous sub prototypes)
[Message part 1 (text/plain, inline)]
This is an automatic notification regarding your bug report
which was filed against the emacs package:

#88: perl-mode - fix syntax of anonymous sub prototypes

It has been closed by Stefan Monnier <monnier <at> IRO.UMontreal.CA>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Stefan Monnier <monnier <at> IRO.UMontreal.CA> by
replying to this email.


-- 
88: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=88
Emacs Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Giuliano Procida" <giuliano.procida <at> googlemail.com>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: perl-mode - fix syntax of anonymous sub prototypes
Date: Thu, 03 Apr 2008 18:10:56 -0400
>     ;; Funny things in sub arg specifications like `sub myfunc ($$)'
>     ;; Be careful not to match "sub { (...) ... }".
>     ("\\<sub[[:space:]]+[^{}[:punct:][:space:]]+[[:space:]]*(\\([^)]+\\))"
> 1 '(1))

> It is still wrong for anonymous subs. Should be (untested):

> "\\<sub\\(?:[[:space:]]+[^{}[:punct:][:space:]]+\\)?[[:space:]]*(\\([^)]+\\))"


Thanks, installed,


        Stefan

[Message part 3 (message/rfc822, inline)]
From: "Giuliano Procida" <giuliano.procida <at> googlemail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: perl-mode - fix syntax of anonymous sub prototypes
Date: Fri, 28 Mar 2008 17:37:08 +0000
Hi.

GNU Emacs 22.1.1 (i386-pc-solaris2.10, X toolkit) of 2008-02-11 on robot

Constructs like this:

    my $del = sub($) {
        my ($old) = @_;
        return if not active($old);
        &$delete_row($old->{$fde_id});
    };

upset later indentation as the $ in the sub($) has the default
backslash syntax class (instead of being treated specially as in
non-anonymous sub definitions) and then the "sub(" triggers the
hanging parens check.

The fix is to modify perl-font-lock-syntactic-keywords to have:

    ;; Funny things in sub arg specifications like `sub myfunc ($$)'
and `sub ($)'
    ("\\<sub\\(?:\\s-+\\S-+\\)?\\s-*(\\([^)]+\\))" 1 '(1))

instead of the existing regexp.

Here's a patch.

--- emacs/22.1/lisp/progmodes/perl-mode.el~   2008-03-28
17:19:19.267639000 +0000
+++ emacs/22.1/lisp/progmodes/perl-mode.el    2008-03-28
17:32:15.510903000 +0000
@@ -265,7 +265,7 @@
     ("\\$ ?{?^?[_a-zA-Z][_a-zA-Z0-9]*\\('\\)[_a-zA-Z]" (1 "_"))
     ;; format statements
     ("^[ \t]*format.*=[ \t]*\\(\n\\)" (1 '(7)))
-    ;; Funny things in sub arg specifications like `sub myfunc ($$)'
+    ;; Funny things in sub arg specifications like `sub myfunc ($$)'
and `sub ($)'
     ("\\<sub\\(?:\\s-+\\S-+\\)?\\s-*(\\([^)]+\\))" 1 '(1))
     ;; regexp and funny quotes
     ("[?:.,;=!~({[][ \t\n]*\\(/\\)" (1 '(7)))

This was really annoying me! If you need a proper test case Perl file,
I can cook one up.

Regards,
Giuliano Procida.




This bug report was last modified 17 years and 111 days ago.

Previous Next


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