Subject: bug#43916: $$, $@, $bla colors in Perl mode vs. Shell-script mode

From: Corwin Brust <[email-masked]>
Date: Wed, 21 Oct 2020 01:25:23 -0500

Hi!

On Tue, Oct 20, 2020 at 6:42 AM 積丹尼 Dan Jacobson <[email-masked]> wrote:
>
> >>>>> "LI" == Lars Ingebrigtsen <[email-masked]> writes:
> LI> 積丹尼 Dan Jacobson <[email-masked]> writes:
>
> >> OK but that doesn't explain the inconsistencies within the same language seen.
>
> LI> The $ is the same colour in Perl mode, so you'll have to be more
> LI> specific about what inconsistencies you're referring to.
>
> All I know is in perl mode,
> $$, $@, $bla
> BB, BB, BTTT (Black, Tan)
>
> So it should be
> BT, BT, BTTT like Shell-script mode,
> or
> BB, BB, BBBB
> or
> TT, TT, TTTT.

I think what we have now makes sense.  I've tried to attach a
screenshot of a -Q session but with (setq cperl-hairy t)

In essence, what I think I see is that cperl will color the whole
array or hash variable including the @ or % sigil when it used as
such, however, when a sigil is used to dereference only sigils is
colored for the hash or array - the scalar being derefered is colored
per scalar (e.g. tan).   This is perhaps the most immediately obvious
difference between perl and cperl-mode and probably a big part of why
I think that cperl provides much better visual feedback than
perl-mode.   (As an aside, I've long wondered if there are people who
perl-mode to cperl-mode and if disagreement about this drives that
preference.)

One thing I could wish for is that scalars used within hash and array
access would be colored just as they are otherwise, e.g. using the tan
color for the $scalar in $arr[$scalar] and $hash{$scalar}.

Otherwise I'm pretty happy; I've not found a better Perl editing
experience than Emacs cperl-mode.

Thanks for your work on this feature!

Corwin