From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8_?= =?UTF-8?Q?=D0=9A=D0=BE=D0=BB=D0=B5=D0=B2?= Newsgroups: gmane.emacs.bugs Subject: bug#26037: 25.1; perl-mode add syntax support for subroutine signatures Date: Sat, 18 Mar 2017 16:24:18 +0200 Message-ID: References: <87bmt259m6.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f40304387f4c7bcb70054b020e64 X-Trace: blaine.gmane.org 1489852285 12347 195.159.176.226 (18 Mar 2017 15:51:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 18 Mar 2017 15:51:25 +0000 (UTC) Cc: 26037@debbugs.gnu.org To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 18 16:51:21 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cpGdJ-0001Yd-Ex for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Mar 2017 16:51:09 +0100 Original-Received: from localhost ([::1]:53748 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpGdP-0000Rs-Bn for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Mar 2017 11:51:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpGdH-0000Ql-Gz for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2017 11:51:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpGdD-000721-7d for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2017 11:51:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35897) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cpGdC-00071t-T2 for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2017 11:51:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cpGdC-0001ev-Mj for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2017 11:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8_?= =?UTF-8?Q?=D0=9A=D0=BE=D0=BB=D0=B5=D0=B2?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Mar 2017 15:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26037 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 26037-submit@debbugs.gnu.org id=B26037.14898522576350 (code B ref 26037); Sat, 18 Mar 2017 15:51:02 +0000 Original-Received: (at 26037) by debbugs.gnu.org; 18 Mar 2017 15:50:57 +0000 Original-Received: from localhost ([127.0.0.1]:34094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cpGd7-0001eM-1H for submit@debbugs.gnu.org; Sat, 18 Mar 2017 11:50:57 -0400 Original-Received: from mail-lf0-f45.google.com ([209.85.215.45]:34237) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cpFHq-0006AF-NX for 26037@debbugs.gnu.org; Sat, 18 Mar 2017 10:24:55 -0400 Original-Received: by mail-lf0-f45.google.com with SMTP id z15so42304162lfd.1 for <26037@debbugs.gnu.org>; Sat, 18 Mar 2017 07:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GvfRacd9DC4HsK6GB6zYwsEU7bNpV9ll9D8ji6mT6rw=; b=mdBfuqTPqJcukWHX68gC6YWAgQo3kytaRknzK/3UvTPjncdF8ZtbGMnomnzJ3ECGey x8v1N05tMMmp9tTXZUdbNTjupdfiiL3yTSAucCge2CAaNXFbyhKfR+xYgAIb5k/O1WTA BCWgxzlxWHzMTQsg0Us2sifQbuNDoDoSyhOPmArzyhKAZGg8HNMWIkWMRrXUBevZRoBk e7pp+js9ZTRfy0I8MNJxHZ85uQDJpfTcY8LoxVobB+yBDuWziuO/STZRga01MYcvo095 G6oR13+7LNUTkEK1OL7Y/c5YOtXsPa5IvJAocXbvTDqKbFptk/N+KJf/8IIxlRo85oU2 eHlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GvfRacd9DC4HsK6GB6zYwsEU7bNpV9ll9D8ji6mT6rw=; b=YVoM1uXbw2nt7BqJJLNJrx7BTPubHU12LDUmAXOAXxuf04g/CETIcXKo1SRJCRC0eE WUNK1zDOZka4d5KosD7j64F5J13MlErF+fzhPWRB318W99A8PgRC7WrNvkrbR9Y6FCDB x9G50uIoBUJ+yAgz14o0WOPAeV13umxHOQcF5/P4/nPilv9/ct5jbVmQlmkk+WO67j5O l0fZ+xIp9a1yvD5RjTw7xE3HpN772+V6r8fRonsDed4t65w5YIArfjXkJTZ+2JXBdwkZ PPs7rORfxOeP8KxKei468+HshFO/barInGJvzXnYNoo9pGfYURYU7xQ6Fid7XYWPtvZ+ A7ww== X-Gm-Message-State: AFeK/H15iLkV3mb6zqhoHJEZQeCQK5N7ewlQM0XADOeYxjehn6dfOaiyvnQug6QD5RJu+zl9U2OZQibRRx6n4g== X-Received: by 10.46.88.79 with SMTP id x15mr6598418ljd.39.1489847088563; Sat, 18 Mar 2017 07:24:48 -0700 (PDT) Original-Received: by 10.25.157.82 with HTTP; Sat, 18 Mar 2017 07:24:18 -0700 (PDT) In-Reply-To: <87bmt259m6.fsf@users.sourceforge.net> X-Mailman-Approved-At: Sat, 18 Mar 2017 11:50:56 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:130698 Archived-At: --f40304387f4c7bcb70054b020e64 Content-Type: text/plain; charset=UTF-8 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 { (...) ... }". - ("\\ wrote: > [Please use Reply All to keep 26037@debbugs.gnu.org on CC] > > > > ---------- Forwarded message ---------- > From: Evgeni Kolev > To: npostavs@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. > > --f40304387f4c7bcb70054b020e64 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Yes, my change does break the indentation test case.<= /div>
So changing the class doesn't seem like a good option.
<= div>
After giving some thought to this, I think we can instea= d
make the regex more strict so that it matches only the
allowed characters in perl's prototypes. The allowed chars
= are:=C2=A0$%&*;@[\]

This is what I have in min= d - diff is pasted below.
However, please note the change below d= oesn't handle
these 3 chars [ / ] =C2=A0I'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/per= l-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -257,7 += 257,7 @@
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (1 (prog1 "\""= ; (perl-syntax-propertize-special-constructs end))))
=C2=A0 =C2= =A0 =C2=A0 =C2=A0;; Funny things in `sub' arg-specs like `sub myfun ($)= ' or `sub ($)'.
=C2=A0 =C2=A0 =C2=A0 =C2=A0;; Be careful = not to match "sub { (...) ... }".
- =C2=A0 =C2=A0 =C2= =A0("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([^)]+= \\))"
+ =C2=A0 =C2=A0 =C2=A0("\\<sub\\(?:[\s\t\n]+\\= (?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([$%&*;@]+\\))"
=C2=A0= =C2=A0 =C2=A0 =C2=A0 (1 "."))
=C2=A0 =C2=A0 =C2=A0 =C2= =A0;; Turn __DATA__ trailer into a comment.
=C2=A0 =C2=A0 =C2=A0 = =C2=A0("^\\(_\\)_\\(?:DATA\\|END\\)__[ \t]*\\(?:\\(\n\\)#.-\\*-.*perl.= *-\\*-\\|\n.*\\)"

On Thu, Mar 16, 2017 at 2:49 AM, = <npo= stavs@users.sourceforge.net> wrote:
[Please use Reply All to keep 26037@debbugs.gnu.org on CC]



---------- Forwarded message ----------
From:=C2=A0Evgeni Kolev = <evgeni.d.kolev@gmail.com>
To:=C2=A0
npostav= s@users.sourceforge.net
Cc:=C2=A0
Bcc:=C2=A0
Date:=C2=A0Wed, 1= 5 Mar 2017 12:00:32 +0200
Subject:=C2=A0Re: bug#26037: 25.1; perl-mode a= dd syntax support for subroutine signatures
OK, I see.

After a bit of testing with C-u C-x =3D, I see that with my proposed
change the sigils in 'sub test ($)' will *not* have punctuation cla= ss
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.=C2=A0 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.cg= i?bug=3D18502#5.


--f40304387f4c7bcb70054b020e64--