GNU bug report logs - #43622
28.0.50; [CLEANUP][PATCH] cperl-mode: Eliminate dead code

Previous Next

Package: emacs;

Reported by: Harald Jörg <haj <at> posteo.de>

Date: Sat, 26 Sep 2020 00:36:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43622 in the body.
You can then email your comments to 43622 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#43622; Package emacs. (Sat, 26 Sep 2020 00:36:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Harald Jörg <haj <at> posteo.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 26 Sep 2020 00:36:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Harald Jörg <haj <at> posteo.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; [CLEANUP][PATCH] cperl-mode: Eliminate dead code
Date: Sat, 26 Sep 2020 02:35:15 +0200
[Message part 1 (text/plain, inline)]
As recently discussed on the emacs-devel list, I'd like to eradicate
conditional code from cperl-mode where the conditionals evaluate to nil.

This is a rather large part of the cleanup, related to all that stuff
which has changed in the last years with regard to font-lock-mode and
cperl-mode's homegrown fontification based on features which are no
longer available.

I tested Perl code on my repositories (twiki.org code and
https://github.com/act-psgi/Act), written by different authors in
different styles, and could not find any change in fontification.

The conditionals leading to dead code are:

 - (featurep 'choose-color) is nil
 - (featurep 'font-lock-extra) is nil
 - (facep 'font-lock-constant-face) is t and
   (boundp 'font-lock-constant-face) is t
   ...same for other faces provided by font-lock-mode.

Once this dead code is eliminated, the macro cperl-force-face and the
function cperl-init-faces-weak (both undocumented) lose their purpose
and are also deleted.

There should be no user-visible changes, so I have made no entry in
etc/NEWS.
--
Cheers,
haj
[0001-cperl-mode-Delete-conditional-code-where-conditions-.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43622; Package emacs. (Sat, 26 Sep 2020 13:54:02 GMT) Full text and rfc822 format available.

Message #8 received at 43622 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Harald Jörg <haj <at> posteo.de>
Cc: 43622 <at> debbugs.gnu.org
Subject: Re: bug#43622: 28.0.50; [CLEANUP][PATCH] cperl-mode: Eliminate dead
 code
Date: Sat, 26 Sep 2020 15:53:14 +0200
Harald Jörg <haj <at> posteo.de> writes:

> As recently discussed on the emacs-devel list, I'd like to eradicate
> conditional code from cperl-mode where the conditionals evaluate to nil.
>
> This is a rather large part of the cleanup, related to all that stuff
> which has changed in the last years with regard to font-lock-mode and
> cperl-mode's homegrown fontification based on features which are no
> longer available.
>
> I tested Perl code on my repositories (twiki.org code and
> https://github.com/act-psgi/Act), written by different authors in
> different styles, and could not find any change in fontification.

Looks good, so I've applied it to Emacs 28 with one change:

In end of data:
progmodes/cperl-mode.el:8525:1: Warning: the function `cperl-init-faces-weak'
    is not known to be defined.

This function was removed, but the call wasn't, so I removed it (and
changed the surrounding code slightly).  If you could check that I
didn't mess up that bit, that'd be nice.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 26 Sep 2020 13:54:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 43622 <at> debbugs.gnu.org and Harald Jörg <haj <at> posteo.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 26 Sep 2020 13:54:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43622; Package emacs. (Sat, 26 Sep 2020 14:43:01 GMT) Full text and rfc822 format available.

Message #15 received at 43622 <at> debbugs.gnu.org (full text, mbox):

From: Harald Jörg <haj <at> posteo.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 43622 <at> debbugs.gnu.org
Subject: Re: bug#43622: 28.0.50; [CLEANUP][PATCH] cperl-mode: Eliminate dead
 code
Date: Sat, 26 Sep 2020 16:42:39 +0200
Lars Ingebrigtsen writes:

> Harald Jörg <haj <at> posteo.de> writes:
> 
>> As recently discussed on the emacs-devel list, I'd like to eradicate
>> conditional code from cperl-mode where the conditionals evaluate to nil.
>>
>> [...]
> 
> Looks good, so I've applied it to Emacs 28 with one change:
> 
> In end of data:
> progmodes/cperl-mode.el:8525:1: Warning: the function `cperl-init-faces-weak'
>     is not known to be defined.
> 
> This function was removed, but the call wasn't, so I removed it (and
> changed the surrounding code slightly).  If you could check that I
> didn't mess up that bit, that'd be nice.

Ouch - my bad.  I missed to apply that hunk.  I had a solution with the
same logic, but less elegant (closer to the original).  Many thanks for
spotting this!

-- 
Cheers,
haj




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 25 Oct 2020 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 233 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.