Subject: bug#69860: 29.2; ERC 5.6-git: erc: Incorrect face formatting applied for fg=99 bg=x (irccontrols module with erc-interpret-mirc-color=t)

From: "J.P." <[email-masked]>
Date: Sun, 17 Mar 2024 10:16:16 -0700

Alcor via General discussion about ERC <[email-masked]> writes:

> On Emacs 29.2, using erc-5.6snapshot0.20240310.61129:
>
> 1. Enable the irccontrols module (for erc)
> 2. Enable `erc-interpret-mirc-color'
> 3. Login onto any IRC network, any channel, or perform a /query session
> 4. Either send, or have someone send you the string ^C99,4Text with a
> red background^C (Key sequence: C-q C-c 99,4Text with a red background
> C-q C-c)
>
> According to https://modern.ircdocs.horse/formatting.html the text
> *should* get formatted with a default foreground, and a red background. The
> observed behavior - however - is that the text is formatted with multiple
> background "bg" faces: (erc-control-default-bg bg:erc-color-face4
> erc-input-face).
>
> A screenshot illustrating the issue is attached to this message.

Oof. Looks like `erc-get-fg-color-face' sets `erc-control-default-bg' in
its catch-all `cond' case. As you say, this produces:

  #("THIS TEXT IS FORMATTED"
    0 22 (font-lock-face (erc-control-default-bg bg:erc-color-face4)))

And `erc-get-bg-color-face' sets `erc-control-default-fg'. Clearly,
whoever's responsible for this outrage should be banished. (Thanks.)