Subject: Re: bug#73580: 29.4; ERC 5.6.1-git: erc-nicks does not respect pal and fool faces
From: "J.P." <[email-masked]>
To: Trevor Arjeski <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Wed, 02 Oct 2024 15:47:22 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Trevor Arjeski <[email-masked]> writes:

> Thanks for the detailed explanation. I did go through with the
> "traditional" approach of adding 'nick-or-keyword, but sadly gave up.

Actually, I think I steered you wrong with that outline thingy
(apologies if that led to a wild goose chase). As you've rightly
observed, the only implementation of `nick-or-keyword' is for
"current-nick", and it behaves rather unintuitively (the one for
"keyword" is a no-op). From the doc:

  `nick-or-keyword' - highlight the nick of the user who typed your
                      nickname, or all instances of the current nickname
                      if there was no sending user

Anyway, mimicking that behavior for "fool" and "pal" obviously won't do.
I think we'd instead want a new variant, something like a `keyword-all'
to highlight all occurrences of a given nick, whether they be in a
speaker tag, an opening address "mention: ", or otherwise.

> Honestly, the more I looked at ERC, the more I realized that I don't
> want pals to be highlighted at all. This makes my first patch irrelevant
> since the whole idea is to use one single face color every time a nick
> appears (similar to weechat's nick highlighting). The same goes for a
> fool, who may appear dimmed, but when someone else mentions the fool you
> will see their nick as the color that erc-nicks assigns.

I believe what I said above applies here too re the either/or
proposition imposed by the "match types" currently on offer.

>> If you're saying `nicks' _should_ highlight your own
>> speaker tags (or should optionally do so), please explain.
>
> This is again about consistency with seeing your own nick within
> brackets (<your_nick>) and in messages that other people send (when
> erc-current-nick-highlight-type is 'nick-or-keyword).

Hm, I guess I was confused by the `erc-my-nick-face' in

  ((equal nick (erc-current-nick)) 'erc-my-nick-face))))

because that concerns the face your speaker tag appears in when you
submit a comment at the prompt. Confusingly, it's actually unrelated to
`erc-current-nick-face', which is the face your mentions appear in after
being treated by `match' (or, as noted above, the face your mentioners
appear in with match types `nick-or-keyword' and `nick').

To avoid such confusion in the future, I think we should supplement
those non-namespaced faces in erc-match.el with preferred aliases, like
`erc-match-current-nick' (new faces aren't supposed to be suffixed with
"-face", I've learned).

Anyway, FWIW, there are actually existing, though perhaps somewhat
roundabout ways to force all occurrences of your nick to use the same
face (if that's ultimately what you're after):

With `match':

  (use-package erc
    :custom
    (erc-modules `(nicks ,@erc-modules)))

  (use-package erc-match
    :custom-face
    (erc-current-nick-face ((t ( :weight unspecified
                                 :foreground unspecified
                                 :inherit erc-my-nick-face)))))

Without `match':

  (use-package erc
    :custom
    (erc-modules `(nicks ,@(remq 'match erc-modules))))

  (use-package erc-nicks
    :custom-face
    ([email-masked]
     ((t (:inherit (erc-button-nick-default-face
                    erc-my-nick-face))))))

Perhaps one of these should go in the manual's Sample Config.

> Not sure what to do! I think we can just close this bug for now.

I've gone ahead and done that, but feel free to continue discussing
should anything related arise (though you may have to unarchive the bug
beforehand if weeks go by). Cheers.