Subject: Re: bug#22867: cperl-mode: Commit d0ad6306 suppresses fontification of hash/array declarations

From: Harald Jörg <[email-masked]>
Date: Tue, 1 Sep 2020 21:44:02 +0200

On 9/1/20 6:34 PM, Stefan Kangas wrote:
> forcemerge 11054 22867
> thanks
> 
> Harald Jörg <[email-masked]> writes:
> 
>> The recent fix d0ad6306 to cperl-mode fixes a lot of unwanted
>> fontification of arrays and hashes, in particular in comments, POD,
>> and strings.  However, as a side effect it also prevents fontification
>> in a variable declaration (this has been observed by choroba):
> 
> It would be very nice to have test cases for all this.

Indeed.  That will take a while, too :)

Not too long ago I stumbled over (or was pointed to?) a suite
https://github.com/Lindydancer/font-lock-regression-suite which also
contains an example in Perl.  Testing this example against its
faceup-counterpart would fail as of today.

> Is the fix worse than the problem?  If yes, maybe it should be reverted?

The fix isn't _worse_.  Strings like "%s" and "%d" in the argument
list of printf being fontified as hashes is indeed idiotic.  Also,
more than once I was annoyed by fontification in POD sections.

On the other hand, declarations of hashes and arrays occur rather
frequently, and there's a lot more in that area that would deserve
some love and care.  So, while this fix was a necessary first step in
any case, some refinement might be desirable to cut off the rough
edges it left.  I don't see an easy way, but this might be well due to
my limited elisp experience.
-- 
Cheers,
haj