From unknown Sat Jun 21 03:21:12 2025 X-Loop: help-debbugs@gnu.org Subject: bug#30549: 25.2; perl-mode: font lock improvement Resent-From: Evgeni Kolev Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Feb 2018 16:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 30549 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 30549@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.151914364017986 (code B ref -1); Tue, 20 Feb 2018 16:21:02 +0000 Received: (at submit) by debbugs.gnu.org; 20 Feb 2018 16:20:40 +0000 Received: from localhost ([127.0.0.1]:53072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoAem-0004g2-CX for submit@debbugs.gnu.org; Tue, 20 Feb 2018 11:20:40 -0500 Received: from eggs.gnu.org ([208.118.235.92]:33406) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoAej-0004fl-Fw for submit@debbugs.gnu.org; Tue, 20 Feb 2018 11:20:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoAed-00081Z-4V for submit@debbugs.gnu.org; Tue, 20 Feb 2018 11:20:32 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:60538) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eoAec-00081R-Vw for submit@debbugs.gnu.org; Tue, 20 Feb 2018 11:20:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoAeb-0004Rm-Ff for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2018 11:20:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoAea-00080U-BV for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2018 11:20:29 -0500 Received: from mail-ot0-x22b.google.com ([2607:f8b0:4003:c0f::22b]:42701) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eoAeZ-0007zu-Oy for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2018 11:20:28 -0500 Received: by mail-ot0-x22b.google.com with SMTP id a7so11896116otk.9 for ; Tue, 20 Feb 2018 08:20:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=k7ByREm67UCQB61zwClzjwOzB77/VeVwieYuHg8lycA=; b=Jd+XPAcmbAKzoIS5oN6ivOqVoer9cPD+07BHm0S/ggCfZuIiaDv0SBgGSj40xiSTi1 Fw0DTqvFkPHYJYgm4sEMiySM7U1sGtVEAJLq+/rjrpxpsidR2nSV+fCjWidADY95n8fD epSAVvJ36bYhArWs+P8cM6sOxMjRzGhnBH1pOQLvfbWcmdN7f9YgceKRCCQ0nPm4KtLE Lg/9VQSmzqgTHfJhBshd4Cv8S+P7+13Sz0ITgLKU/X9it695kEVRunk8LXmKYGN3cYwa uEbhjkGInRwsniMBh53QgTqG2aiwNen48FkXT7bmAXVoMefKl9imJUH9eXW8c9gcrQFi W6HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=k7ByREm67UCQB61zwClzjwOzB77/VeVwieYuHg8lycA=; b=I1UAlOgCcqivaUantTDblR5/hhtDW9+5SUyMSVxDBrdPOGRyYM5ftPRqTu6tUpcmJ0 EeYwepOy4v7LYcRu5rSR09rtOk+LBLw3cE4fNMswAJMBAuJGKwdJmKr1LTp7Teidut5p GwFYTLrwIY51WfVcsBWFbO0fQOaCE3IX9yPU0q1TgRGTYjft3P38zGs7eVbhX8ruTqvZ rnFKoDgYPpbuyF6GCEysuPK+H9at7cqWPB1TuTnssVphBmCeXXSP7avEyaH1z3/uhUYd o/iucgCP3e3AT3vQ4pLITFQv2QiuFPA5rzKP70yrnBbftAA9KiVeMLPYbcey8U/H+t+z nM9A== X-Gm-Message-State: APf1xPDwFaU0OukcPDA53nUW6WDR3zm7LSl/1mcIpLkF6vNuzii4g7Pj iAPqBYuc4wxccfKFJDnqHtnZvFPpW/jvvguwC9HOJQ== X-Google-Smtp-Source: AH8x227IILhMjfgJeAfs3hkKcSPdreIqRc6atjGhrs6WVL5XPRSwdYXJ5StOr6NAzXbBx5ae+Dx8tQl1/lqvurzEDZo= X-Received: by 10.157.3.65 with SMTP id 59mr127242otv.139.1519143626416; Tue, 20 Feb 2018 08:20:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.168.167.137 with HTTP; Tue, 20 Feb 2018 08:19:55 -0800 (PST) From: Evgeni Kolev Date: Tue, 20 Feb 2018 18:19:55 +0200 X-Google-Sender-Auth: sA5rqTw6tBy80JdrHHsCLF2oGE4 Message-ID: Content-Type: multipart/alternative; boundary="94eb2c0344de3726430565a730b9" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --94eb2c0344de3726430565a730b9 Content-Type: text/plain; charset="UTF-8" I'm reporting an issue with perl-mode's font lock for perl keywords, and suggesting a fix. To reproduce: - emacs -Q - clear the scratch buffer - M-x perl-mode - enter the following text: use Fake; my $use = 123; my $var = 123; - observe the issue: `$use` is incorrectly highlighted - it should be highlighted with the same color as `$var`, but it's highlighted with the same color as `use` (on the first line). The fix I suggest is borrowed from cperl-mode - extend the font lock regex to *not* match keywords if they start with a perl sigil. The diff is below, please let me know if it can be improved. I've signed the copyright assignment. >From 8d1977cfc6c4884b231270c33c3bdabbd16b14aa Mon Sep 17 00:00:00 2001 From: Evgeni Kolev Date: Tue, 20 Feb 2018 18:14:29 +0200 Subject: [PATCH] lisp/progmodes/perl-mode.el: keyword regex must not match sigils --- lisp/progmodes/perl-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index 9948078..c1d94ac 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -165,7 +165,7 @@ perl-font-lock-keywords-1 ;; Fontify function and package names in declarations. ("\\<\\(package\\|sub\\)\\>[ \t]*\\(\\sw+\\)?" (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t)) - ("\\<\\(import\\|no\\|require\\|use\\)\\>[ \t]*\\(\\sw+\\)?" + ("\\(^\\|[^$@%&\\]\\)\\<\\(import\\|no\\|require\\|use\\)\\>[ \t]*\\(\\sw+\\)?" (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))) "Subdued level highlighting for Perl mode.") -- 2.9.0 --94eb2c0344de3726430565a730b9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'm reporting an issue with perl-mode's font lock = for perl keywords, and suggesting a fix.

To reproduce:

- emacs -Q
- clear the scratch buffer
- M-x perl-mode
- enter the following text:

=
=C2=A0 =C2=A0 use Fake;
=C2=A0 =C2=A0 my $use =3D= 123;
=C2=A0 =C2=A0 my $var =3D 123;

- observe the issue: `$use` is incorrectly highlighted - it should be hi= ghlighted with the same color as `$var`, but it's highlighted with the = same color as `use` (on the first line).

The fix I= suggest is borrowed from cperl-mode - extend the font lock regex to *not* = match keywords if they start with a perl sigil.

Th= e diff is below, please let me know if it can be improved. I've signed = the copyright assignment.

From 8d1977cfc6c488= 4b231270c33c3bdabbd16b14aa Mon Sep 17 00:00:00 2001
From: Evgeni = Kolev <evgenysw@gmail.com><= /div>
Date: Tue, 20 Feb 2018 18:14:29 +0200
Subject: [PATCH] = lisp/progmodes/perl-mode.el: keyword regex must not match
=C2=A0s= igils

---
=C2=A0lisp/progmodes/perl-mode= .el | 2 +-
=C2=A01 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/progmodes/perl-mode.el b/lisp/prog= modes/perl-mode.el
index 9948078..c1d94ac 100644
--- a/= lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -165,7 +165,7 @@ perl-font-lock-keywords-1
=C2=A0 =C2= =A0 =C2=A0;; Fontify function and package names in declarations.
= =C2=A0 =C2=A0 =C2=A0("\\<\\(package\\|sub\\)\\>[ \t]*\\(\\sw+\\)= ?"
=C2=A0 =C2=A0 =C2=A0 (1 font-lock-keyword-face) (2 font-l= ock-function-name-face nil t))
-=C2=A0 =C2=A0 ("\\<\\(imp= ort\\|no\\|require\\|use\\)\\>[ \t]*\\(\\sw+\\)?"
+=C2=A0= =C2=A0 ("\\(^\\|[^$@%&\\]\\)\\<\\(import\\|no\\|require\\|use\= \)\\>[ \t]*\\(\\sw+\\)?"
=C2=A0 =C2=A0 =C2=A0 (1 font-loc= k-keyword-face) (2 font-lock-constant-face nil t)))
=C2=A0 =C2=A0= "Subdued level highlighting for Perl mode.")

=
--
2.9.0

--94eb2c0344de3726430565a730b9-- From unknown Sat Jun 21 03:21:12 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Evgeni Kolev Subject: bug#30549: closed (Re: bug#30549: 25.2; perl-mode: font lock improvement) Message-ID: References: <837eqtv2js.fsf@gnu.org> X-Gnu-PR-Message: they-closed 30549 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 30549@debbugs.gnu.org Date: Sat, 03 Mar 2018 11:10:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1520075402-19153-1" This is a multi-part message in MIME format... ------------=_1520075402-19153-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #30549: 25.2; perl-mode: font lock improvement which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 30549@debbugs.gnu.org. --=20 30549: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D30549 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1520075402-19153-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 30549-done) by debbugs.gnu.org; 3 Mar 2018 11:09:06 +0000 Received: from localhost ([127.0.0.1]:41843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1es52H-0004xl-Ru for submit@debbugs.gnu.org; Sat, 03 Mar 2018 06:09:06 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34099) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1es52G-0004xI-Rf for 30549-done@debbugs.gnu.org; Sat, 03 Mar 2018 06:09:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1es528-0006sB-J8 for 30549-done@debbugs.gnu.org; Sat, 03 Mar 2018 06:08:59 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:49342) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1es528-0006s4-EZ; Sat, 03 Mar 2018 06:08:56 -0500 Received: from [176.228.60.248] (port=4563 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1es527-0006Qd-Qs; Sat, 03 Mar 2018 06:08:56 -0500 Date: Sat, 03 Mar 2018 13:09:11 +0200 Message-Id: <837eqtv2js.fsf@gnu.org> From: Eli Zaretskii To: Evgeni Kolev In-reply-to: (message from Evgeni Kolev on Tue, 20 Feb 2018 18:19:55 +0200) Subject: Re: bug#30549: 25.2; perl-mode: font lock improvement References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 30549-done Cc: 30549-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Evgeni Kolev > Date: Tue, 20 Feb 2018 18:19:55 +0200 > > I'm reporting an issue with perl-mode's font lock for perl keywords, and > suggesting a fix. > > To reproduce: > > - emacs -Q > - clear the scratch buffer > - M-x perl-mode > - enter the following text: > > use Fake; > my $use = 123; > my $var = 123; > > - observe the issue: `$use` is incorrectly highlighted - it should be > highlighted with the same color as `$var`, but it's highlighted with the > same color as `use` (on the first line). > > The fix I suggest is borrowed from cperl-mode - extend the font lock regex > to *not* match keywords if they start with a perl sigil. Thanks, pushed to the master branch. In the future, please accompany your contributions with a Git log message formatted like ChangeLog, see CONTRIBUTE for the details. ------------=_1520075402-19153-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 20 Feb 2018 16:20:40 +0000 Received: from localhost ([127.0.0.1]:53072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoAem-0004g2-CX for submit@debbugs.gnu.org; Tue, 20 Feb 2018 11:20:40 -0500 Received: from eggs.gnu.org ([208.118.235.92]:33406) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoAej-0004fl-Fw for submit@debbugs.gnu.org; Tue, 20 Feb 2018 11:20:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoAed-00081Z-4V for submit@debbugs.gnu.org; Tue, 20 Feb 2018 11:20:32 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:60538) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eoAec-00081R-Vw for submit@debbugs.gnu.org; Tue, 20 Feb 2018 11:20:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoAeb-0004Rm-Ff for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2018 11:20:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoAea-00080U-BV for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2018 11:20:29 -0500 Received: from mail-ot0-x22b.google.com ([2607:f8b0:4003:c0f::22b]:42701) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eoAeZ-0007zu-Oy for bug-gnu-emacs@gnu.org; Tue, 20 Feb 2018 11:20:28 -0500 Received: by mail-ot0-x22b.google.com with SMTP id a7so11896116otk.9 for ; Tue, 20 Feb 2018 08:20:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=k7ByREm67UCQB61zwClzjwOzB77/VeVwieYuHg8lycA=; b=Jd+XPAcmbAKzoIS5oN6ivOqVoer9cPD+07BHm0S/ggCfZuIiaDv0SBgGSj40xiSTi1 Fw0DTqvFkPHYJYgm4sEMiySM7U1sGtVEAJLq+/rjrpxpsidR2nSV+fCjWidADY95n8fD epSAVvJ36bYhArWs+P8cM6sOxMjRzGhnBH1pOQLvfbWcmdN7f9YgceKRCCQ0nPm4KtLE Lg/9VQSmzqgTHfJhBshd4Cv8S+P7+13Sz0ITgLKU/X9it695kEVRunk8LXmKYGN3cYwa uEbhjkGInRwsniMBh53QgTqG2aiwNen48FkXT7bmAXVoMefKl9imJUH9eXW8c9gcrQFi W6HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=k7ByREm67UCQB61zwClzjwOzB77/VeVwieYuHg8lycA=; b=I1UAlOgCcqivaUantTDblR5/hhtDW9+5SUyMSVxDBrdPOGRyYM5ftPRqTu6tUpcmJ0 EeYwepOy4v7LYcRu5rSR09rtOk+LBLw3cE4fNMswAJMBAuJGKwdJmKr1LTp7Teidut5p GwFYTLrwIY51WfVcsBWFbO0fQOaCE3IX9yPU0q1TgRGTYjft3P38zGs7eVbhX8ruTqvZ rnFKoDgYPpbuyF6GCEysuPK+H9at7cqWPB1TuTnssVphBmCeXXSP7avEyaH1z3/uhUYd o/iucgCP3e3AT3vQ4pLITFQv2QiuFPA5rzKP70yrnBbftAA9KiVeMLPYbcey8U/H+t+z nM9A== X-Gm-Message-State: APf1xPDwFaU0OukcPDA53nUW6WDR3zm7LSl/1mcIpLkF6vNuzii4g7Pj iAPqBYuc4wxccfKFJDnqHtnZvFPpW/jvvguwC9HOJQ== X-Google-Smtp-Source: AH8x227IILhMjfgJeAfs3hkKcSPdreIqRc6atjGhrs6WVL5XPRSwdYXJ5StOr6NAzXbBx5ae+Dx8tQl1/lqvurzEDZo= X-Received: by 10.157.3.65 with SMTP id 59mr127242otv.139.1519143626416; Tue, 20 Feb 2018 08:20:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.168.167.137 with HTTP; Tue, 20 Feb 2018 08:19:55 -0800 (PST) From: Evgeni Kolev Date: Tue, 20 Feb 2018 18:19:55 +0200 X-Google-Sender-Auth: sA5rqTw6tBy80JdrHHsCLF2oGE4 Message-ID: Subject: 25.2; perl-mode: font lock improvement To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="94eb2c0344de3726430565a730b9" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --94eb2c0344de3726430565a730b9 Content-Type: text/plain; charset="UTF-8" I'm reporting an issue with perl-mode's font lock for perl keywords, and suggesting a fix. To reproduce: - emacs -Q - clear the scratch buffer - M-x perl-mode - enter the following text: use Fake; my $use = 123; my $var = 123; - observe the issue: `$use` is incorrectly highlighted - it should be highlighted with the same color as `$var`, but it's highlighted with the same color as `use` (on the first line). The fix I suggest is borrowed from cperl-mode - extend the font lock regex to *not* match keywords if they start with a perl sigil. The diff is below, please let me know if it can be improved. I've signed the copyright assignment. >From 8d1977cfc6c4884b231270c33c3bdabbd16b14aa Mon Sep 17 00:00:00 2001 From: Evgeni Kolev Date: Tue, 20 Feb 2018 18:14:29 +0200 Subject: [PATCH] lisp/progmodes/perl-mode.el: keyword regex must not match sigils --- lisp/progmodes/perl-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index 9948078..c1d94ac 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -165,7 +165,7 @@ perl-font-lock-keywords-1 ;; Fontify function and package names in declarations. ("\\<\\(package\\|sub\\)\\>[ \t]*\\(\\sw+\\)?" (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t)) - ("\\<\\(import\\|no\\|require\\|use\\)\\>[ \t]*\\(\\sw+\\)?" + ("\\(^\\|[^$@%&\\]\\)\\<\\(import\\|no\\|require\\|use\\)\\>[ \t]*\\(\\sw+\\)?" (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))) "Subdued level highlighting for Perl mode.") -- 2.9.0 --94eb2c0344de3726430565a730b9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'm reporting an issue with perl-mode's font lock = for perl keywords, and suggesting a fix.

To reproduce:

- emacs -Q
- clear the scratch buffer
- M-x perl-mode
- enter the following text:

=
=C2=A0 =C2=A0 use Fake;
=C2=A0 =C2=A0 my $use =3D= 123;
=C2=A0 =C2=A0 my $var =3D 123;

- observe the issue: `$use` is incorrectly highlighted - it should be hi= ghlighted with the same color as `$var`, but it's highlighted with the = same color as `use` (on the first line).

The fix I= suggest is borrowed from cperl-mode - extend the font lock regex to *not* = match keywords if they start with a perl sigil.

Th= e diff is below, please let me know if it can be improved. I've signed = the copyright assignment.

From 8d1977cfc6c488= 4b231270c33c3bdabbd16b14aa Mon Sep 17 00:00:00 2001
From: Evgeni = Kolev <evgenysw@gmail.com><= /div>
Date: Tue, 20 Feb 2018 18:14:29 +0200
Subject: [PATCH] = lisp/progmodes/perl-mode.el: keyword regex must not match
=C2=A0s= igils

---
=C2=A0lisp/progmodes/perl-mode= .el | 2 +-
=C2=A01 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/progmodes/perl-mode.el b/lisp/prog= modes/perl-mode.el
index 9948078..c1d94ac 100644
--- a/= lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -165,7 +165,7 @@ perl-font-lock-keywords-1
=C2=A0 =C2= =A0 =C2=A0;; Fontify function and package names in declarations.
= =C2=A0 =C2=A0 =C2=A0("\\<\\(package\\|sub\\)\\>[ \t]*\\(\\sw+\\)= ?"
=C2=A0 =C2=A0 =C2=A0 (1 font-lock-keyword-face) (2 font-l= ock-function-name-face nil t))
-=C2=A0 =C2=A0 ("\\<\\(imp= ort\\|no\\|require\\|use\\)\\>[ \t]*\\(\\sw+\\)?"
+=C2=A0= =C2=A0 ("\\(^\\|[^$@%&\\]\\)\\<\\(import\\|no\\|require\\|use\= \)\\>[ \t]*\\(\\sw+\\)?"
=C2=A0 =C2=A0 =C2=A0 (1 font-loc= k-keyword-face) (2 font-lock-constant-face nil t)))
=C2=A0 =C2=A0= "Subdued level highlighting for Perl mode.")

=
--
2.9.0

--94eb2c0344de3726430565a730b9-- ------------=_1520075402-19153-1--