From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Protesilaos Stavrou Newsgroups: gmane.emacs.bugs Subject: bug#45840: 28.0.50; [PATCH] Remove hardcoded underline for perl-mode variables Date: Tue, 19 Jan 2021 09:07:27 +0200 Message-ID: <87a6t51k28.fsf@protesilaos.com> References: <87sg757xw0.fsf@protesilaos.com> <87o8hlmo7h.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35800"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 45840@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 19 08:08:17 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1l7h-0009Cl-Hu for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 Jan 2021 08:08:17 +0100 Original-Received: from localhost ([::1]:58890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1l7f-00052q-Vp for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 Jan 2021 02:08:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1l7S-00051D-Ik for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2021 02:08:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37696) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1l7S-0003If-BM for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2021 02:08:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l1l7S-0000Yx-5t for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2021 02:08:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Protesilaos Stavrou Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Jan 2021 07:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45840 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 45840-submit@debbugs.gnu.org id=B45840.16110400622137 (code B ref 45840); Tue, 19 Jan 2021 07:08:02 +0000 Original-Received: (at 45840) by debbugs.gnu.org; 19 Jan 2021 07:07:42 +0000 Original-Received: from localhost ([127.0.0.1]:49242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l1l78-0000YP-8W for submit@debbugs.gnu.org; Tue, 19 Jan 2021 02:07:42 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:43589) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l1l75-0000YA-Qn for 45840@debbugs.gnu.org; Tue, 19 Jan 2021 02:07:40 -0500 X-Originating-IP: 94.46.225.161 Original-Received: from kronos (unknown [94.46.225.161]) (Authenticated sender: public@protesilaos.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 999111BF205; Tue, 19 Jan 2021 07:07:30 +0000 (UTC) In-Reply-To: <87o8hlmo7h.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 19 Jan 2021 07:32:18 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:198140 Archived-At: --=-=-= Content-Type: text/plain On 2021-01-19, 07:32 +0100, Lars Ingebrigtsen wrote: > Protesilaos Stavrou writes: > >> The attached patch merely assigns font-lock-variable-name-face while >> removing the hardcoded underline property. >> >> If you think that the underline should remain in place, then I can >> provide another patch that would add a new face which would inherit from >> font-lock-variable-name-face and add an underline accordingly. > > The comment here mentions this: > > ;; Additionally underline non-scalar variables. Maybe this is a bad idea. > ;;'("[$@%*][#{]?\\(\\sw+\\)" 1 font-lock-variable-name-face) > ("[$*]{?\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-variable-name-face) > ("\\([@%]\\|\\$#\\)\\(\\sw+\\(::\\sw+\\)*\\)" > (2 (cons font-lock-variable-name-face '(underline)))) > > And it is a bad idea to hard-code this, but having different faces here > makes sense, I think. So could you whip up another patch to add the new > face, as you suggested? Thank you, Lars! Please find attached the new patch. I also added a NEWS entry. Feel free to edit it as you will. -- Protesilaos Stavrou protesilaos.com --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-perl-non-scalar-variable-face-to-perl-mode.patch >From 161ba7a2a406122c95ab0bb41d1b1bc9bde2d565 Mon Sep 17 00:00:00 2001 From: Protesilaos Stavrou Date: Tue, 19 Jan 2021 09:04:17 +0200 Subject: [PATCH] Add 'perl-non-scalar-variable' face to perl-mode * lisp/progmodes/perl-mode.el (perl-non-scalar-variable): Define new face. (perl-font-lock-keywords-2): Apply 'perl-non-scalar-variable' face. * etc/NEWS: Document the new face. --- etc/NEWS | 6 ++++++ lisp/progmodes/perl-mode.el | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index d632283e7f..8fc5f3e046 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -352,6 +352,12 @@ When emacsclient connects, Emacs will (by default) output a message about how to exit the client frame. If 'server-client-instructions' is set to nil, this message is inhibited. +** Perl mode + +--- +*** New face 'perl-non-scalar-variable'. +This is used to fontify non-scalar variables. + ** Python mode *** 'python-shell-interpreter' now defaults to python3 on systems with python3. diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index 2a2a4978c6..d047dd543c 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -95,6 +95,12 @@ perl :prefix "perl-" :group 'languages) +(defface perl-non-scalar-variable + '((t :inherit font-lock-variable-name-face :underline t)) + "Face used for non-scalar variables." + :version "28.1" + :group 'perl) + (defvar perl-mode-abbrev-table nil "Abbrev table in use in perl-mode buffers.") (define-abbrev-table 'perl-mode-abbrev-table ()) @@ -187,11 +193,12 @@ perl-font-lock-keywords-2 ;; ;; Fontify function, variable and file name references. ("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-function-name-face) - ;; Additionally underline non-scalar variables. Maybe this is a bad idea. + ;; Additionally fontify non-scalar variables. `perl-non-scalar-variable' + ;; will underline them by default. ;;'("[$@%*][#{]?\\(\\sw+\\)" 1 font-lock-variable-name-face) ("[$*]{?\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-variable-name-face) ("\\([@%]\\|\\$#\\)\\(\\sw+\\(::\\sw+\\)*\\)" - (2 (cons font-lock-variable-name-face '(underline)))) + (2 'perl-non-scalar-variable)) ("<\\(\\sw+\\)>" 1 font-lock-constant-face) ;; ;; Fontify keywords with/and labels as we do in `c++-font-lock-keywords'. -- 2.30.0 --=-=-=--