unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* perl-mode - fix syntax of anonymous sub prototypes
@ 2008-03-28 17:37 Giuliano Procida
  2008-03-29  8:43 ` Giuliano Procida
  0 siblings, 1 reply; 6+ messages in thread
From: Giuliano Procida @ 2008-03-28 17:37 UTC (permalink / raw)
  To: bug-gnu-emacs

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.




^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <mailman.9555.1206755263.18990.bug-gnu-emacs@gnu.org>]

end of thread, other threads:[~2008-04-03 22:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-28 17:37 perl-mode - fix syntax of anonymous sub prototypes Giuliano Procida
2008-03-29  8:43 ` Giuliano Procida
2008-03-29 14:58   ` Giuliano Procida
     [not found]   ` <mailman.9574.1206802710.18990.bug-gnu-emacs@gnu.org>
2008-03-29 15:39     ` Joost Diepenmaat
2008-04-03 22:10   ` Stefan Monnier
     [not found] <mailman.9555.1206755263.18990.bug-gnu-emacs@gnu.org>
2008-03-29 11:23 ` Joost Diepenmaat

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).