GNU bug report logs -
#88
perl-mode - fix syntax of anonymous sub prototypes
Previous Next
Full log
View this message in rfc822 format
[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)]
> ;; 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)]
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.