GNU bug report logs -
#26037
25.1; perl-mode add syntax support for subroutine signatures
Previous Next
Reported by: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>
Date: Thu, 9 Mar 2017 17:25:02 UTC
Severity: wishlist
Tags: fixed, patch
Found in version 25.1
Fixed in version 26.1
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
Message #19 received at 26037 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Yes, my change does break the indentation test case.
So changing the class doesn't seem like a good option.
After giving some thought to this, I think we can instead
make the regex more strict so that it matches only the
allowed characters in perl's prototypes. The allowed chars
are: $%&*;@[\]
This is what I have in mind - diff is pasted below.
However, please note the change below doesn't handle
these 3 chars [ / ] I'll add them if you think this is the correct
approach:
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index a516f07..840aa4e 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -257,7 +257,7 @@
(1 (prog1 "\"" (perl-syntax-propertize-special-constructs end))))
;; Funny things in `sub' arg-specs like `sub myfun ($)' or `sub ($)'.
;; Be careful not to match "sub { (...) ... }".
- ("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([^)]+\\))"
+
("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([$%&*;@]+\\))"
(1 "."))
;; Turn __DATA__ trailer into a comment.
("^\\(_\\)_\\(?:DATA\\|END\\)__[
\t]*\\(?:\\(\n\\)#.-\\*-.*perl.*-\\*-\\|\n.*\\)"
On Thu, Mar 16, 2017 at 2:49 AM, <npostavs <at> users.sourceforge.net> wrote:
> [Please use Reply All to keep 26037 <at> debbugs.gnu.org on CC]
>
>
>
> ---------- Forwarded message ----------
> From: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>
> To: npostavs <at> users.sourceforge.net
> Cc:
> Bcc:
> Date: Wed, 15 Mar 2017 12:00:32 +0200
> Subject: Re: bug#26037: 25.1; perl-mode add syntax support for subroutine
> signatures
> OK, I see.
>
> After a bit of testing with C-u C-x =, I see that with my proposed
> change the sigils in 'sub test ($)' will *not* have punctuation class
> as they did before the chagne.
>
> I see these options:
>
> 1. I can try to improve the proposed change to preserve backward
> compatibility - I can try to add another rule which will strictly
> match only the allowed prototype-sigils $%&*;@[\]
>
> 2. discard my proposed change as it might have undesired side effects -
> at this point, I don't see anything in perl-mode which depends on
> these prototype-sigils having punctioation class, however, I could be
> missing something.
>
> 3. accept my proposed change as-is, but we must be sure nothing will
> be broken as a result. I'm sure syntax highlighting will not be
> broken (I've tested with different themes, different perl sub
> definitions).
>
> Please let me know what you think.
>
>
>
> I ran git blame against the relevant lines, and turned up Bug#18502.
> Please check if your change breaks the indentation test case at
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=18502#5.
>
>
[Message part 2 (text/html, inline)]
This bug report was last modified 8 years and 51 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.