From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alcor via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs 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) Date: Sun, 17 Mar 2024 18:23:58 +0100 Message-ID: <87zfuwojpt.fsf__27463.6849224166$1710696356$gmane$org@tilde.club> References: <874jd4q0pb.fsf@tilde.club> <87wmq0srrz.fsf@neverwas.me> Reply-To: Alcor Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31271"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 69860@debbugs.gnu.org, Alcor via General discussion about ERC To: "J.P." Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 17 18:25:47 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rluGZ-0007tJ-7i for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Mar 2024 18:25:47 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rluGO-0003Nh-Nt; Sun, 17 Mar 2024 13:25:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rluGD-0003Kx-UM for bug-gnu-emacs@gnu.org; Sun, 17 Mar 2024 13:25:27 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rluGC-00040Y-ES for bug-gnu-emacs@gnu.org; Sun, 17 Mar 2024 13:25:25 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rluGn-0006AQ-M4 for bug-gnu-emacs@gnu.org; Sun, 17 Mar 2024 13:26:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alcor Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Mar 2024 17:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69860 X-GNU-PR-Package: emacs Original-Received: via spool by 69860-submit@debbugs.gnu.org id=B69860.171069631323609 (code B ref 69860); Sun, 17 Mar 2024 17:26:01 +0000 Original-Received: (at 69860) by debbugs.gnu.org; 17 Mar 2024 17:25:13 +0000 Original-Received: from localhost ([127.0.0.1]:58932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rluG0-00068h-PV for submit@debbugs.gnu.org; Sun, 17 Mar 2024 13:25:13 -0400 Original-Received: from tilde.club ([142.44.150.184]:54706 ident=postfix) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rluFy-00068U-HP for 69860@debbugs.gnu.org; Sun, 17 Mar 2024 13:25:10 -0400 Original-Received: from topazii.tilde.club (unknown [IPv6:2001:9e8:7e3:2a00:e587:1f57:b4a6:c275]) by tilde.club (Postfix) with ESMTPSA id 68D6D22009079; Sun, 17 Mar 2024 17:24:01 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 tilde.club 68D6D22009079 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.club; s=mail; t=1710696241; bh=EYVral91ONpSZSHKLJuFfZzH7n+S3t9I0EGb5FTHjnk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=yQtIfxsPLMmVhj5Bsla19OgxNglXtFKQ0ZtWjcM2jEfaAr2Xmvmy2wsDgtSXutsGl ngCfZ/7CZEGS2ntr6QFeNBaKhT3QsJCiXXOY9wAk8ZH6eKkgKfhsiKYC1R2hgXjhGD uRDmP3Jd/hPoY6NA2xlv8wjjPHy191x4cTxSS9vA= In-Reply-To: <87wmq0srrz.fsf@neverwas.me> (J. P.'s message of "Sun, 17 Mar 2024 10:16:16 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:281768 Archived-At: --=-=-= Content-Type: text/plain "J.P." writes: > 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.) Yes, that's part of the issue. However, `erc-controls-propertize' should also avoid adding the default fg/bg to the font lock face if n=99 to avoid overriding an existing fg,bg setting if fg=99,bg=x or bg=99,fg=x. This is trivially fixable and it's possible you already have a fix, but I'm attaching a patchset that works for me FWIW, just to illustrate what I had to change in order to make it work. Cheers, -A --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Fix-typo-in-erc-get-fg-bg-color-face.patch >From 9b8a55c705f305a4aa0da85ee43741e929fb9cfc Mon Sep 17 00:00:00 2001 From: "F. Moukayed" Date: Sun, 17 Mar 2024 16:43:36 +0000 Subject: [PATCH 1/2] Fix typo in erc-get-{fg,bg}-color-face * lisp/erc/erc-goodies.el (erc-get-{fg,bg}-color-face): Fix wrong return value when n=99. --- lisp/erc/erc-goodies.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el index da14f5b..93b888a 100644 --- a/lisp/erc/erc-goodies.el +++ b/lisp/erc/erc-goodies.el @@ -812,7 +812,7 @@ The value `erc-interpret-controls-p' must also be t for this to work." (intern (concat "bg:erc-color-face" (number-to-string n)))) ((< 15 n 99) (list :background (aref erc--controls-additional-colors (- n 16)))) - (t (erc-log (format " Wrong color: %s" n)) 'erc-control-default-fg)))) + (t (erc-log (format " Wrong color: %s" n)) 'erc-control-default-bg)))) (defun erc-get-fg-color-face (n) "Fetches the right face for foreground color N (0-15)." @@ -828,7 +828,7 @@ The value `erc-interpret-controls-p' must also be t for this to work." (intern (concat "fg:erc-color-face" (number-to-string n)))) ((< 15 n 99) (list :foreground (aref erc--controls-additional-colors (- n 16)))) - (t (erc-log (format " Wrong color: %s" n)) 'erc-control-default-bg)))) + (t (erc-log (format " Wrong color: %s" n)) 'erc-control-default-fg)))) ;;;###autoload(autoload 'erc-irccontrols-mode "erc-goodies" nil t) (define-erc-module irccontrols nil -- 2.34.1 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0002-Fix-wrong-color-rendering-when-bg-99-or-fg-99.patch >From efd3fe14378a8f51dcc4946d573c5ae243778084 Mon Sep 17 00:00:00 2001 From: "F. Moukayed" Date: Sun, 17 Mar 2024 17:16:35 +0000 Subject: [PATCH 2/2] Fix wrong color rendering when bg=99 or fg=99 * lisp/erc/erc-goodies.el (erc-controls-propertize): Avoid prepending the bg/fg face if it's defaulted (99). --- lisp/erc/erc-goodies.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el index 93b888a..52bd177 100644 --- a/lisp/erc/erc-goodies.el +++ b/lisp/erc/erc-goodies.el @@ -1002,10 +1002,10 @@ to a region in the current buffer." (if underlinep '(erc-underline-face) nil) - (if fg + (if (and fg (not (equal fg 'erc-control-default-fg))) (list fg) nil) - (if bg + (if (and bg (not (equal bg 'erc-control-default-bg))) (list bg) nil)) str) -- 2.34.1 --=-=-=--