From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 25 15:28:06 2025 Received: (at submit) by debbugs.gnu.org; 25 Aug 2025 19:28:06 +0000 Received: from localhost ([127.0.0.1]:51291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uqcrN-0008W8-RH for submit@debbugs.gnu.org; Mon, 25 Aug 2025 15:28:06 -0400 Received: from lists.gnu.org ([2001:470:142::17]:55758) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uqcrC-0008VO-LO for submit@debbugs.gnu.org; Mon, 25 Aug 2025 15:27:58 -0400 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 1uqcr5-0004pN-6E for bug-gnu-emacs@gnu.org; Mon, 25 Aug 2025 15:27:47 -0400 Received: from tilde.club ([142.44.150.184]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uqcqx-0003bU-KC for bug-gnu-emacs@gnu.org; Mon, 25 Aug 2025 15:27:45 -0400 Received: from osiris.tilde.club (unknown [IPv6:2001:9e8:7e0:a700:3b71:605c:38a0:9d38]) by tilde.club (Postfix) with ESMTPSA id 0D61A2256D95B for ; Mon, 25 Aug 2025 19:27:26 +0000 (UTC) Authentication-Results: tilde.club; auth=pass smtp.auth=alcor smtp.mailfrom=alcor@tilde.club DKIM-Filter: OpenDKIM Filter v2.11.0 tilde.club 0D61A2256D95B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.club; s=mail; t=1756150047; bh=hRI5Vosz5zXMvornEXsr6tIDuFbjDXp/TcJVErz8jiU=; h=From:To:Subject:Date:From; b=izIO7ZuisJyVZilYgnBNulKD/46JzkVytuvDo3Wq15AgQUa3uFeHgrRRyTpYxfjf2 LhH9VKn4xbkt3P1M2rlcELU268DgMEQJPaGSybxKnEnvEjPUaROHuGvISZei4M8jyN 58TlPRdGaLGDOBfjJduQP4uaVdeKDfugTfyIDZbM= From: Alcor To: bug-gnu-emacs@gnu.org Subject: [PATCH] Fix parsing single-digit color codes in rcirc Date: Mon, 25 Aug 2025 21:27:17 +0200 Message-ID: <87y0r7p5gq.fsf@tilde.club> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=142.44.150.184; envelope-from=alcor@tilde.club; helo=tilde.club X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch According to https://modern.ircdocs.horse/formatting#color IRC color codes may consist of a single digit, e.g. ^C3IRC^C. See https://modern.ircdocs.horse/formatting#examples for further examples. The provided two-liner patch relaxes the regexps used for parsing accordingly so that the single-digit case is supported. In GNU Emacs 30.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) of 2025-08-15 built on lcy02-amd64-116 Repository revision: 32909ac267415e06a8b18a8b89827d7bbf180b58 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12302006 System Description: Ubuntu 24.04.2 LTS Configured using: 'configure --prefix=/snap/emacs/current/usr --with-x-toolkit=gtk3 --without-xaw3d --with-modules --with-cairo --with-native-compilation=aot --without-pgtk --with-xinput2 --with-tree-sitter 'CFLAGS=-isystem /build/emacs/parts/emacs/install/usr/include -isystem /build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu -isystem /build/emacs/stage/usr/include -O2' 'CPPFLAGS=-isystem /build/emacs/parts/emacs/install/usr/include -isystem /build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu -isystem /build/emacs/stage/usr/include' 'LDFLAGS=-L/build/emacs/parts/emacs/install/lib -L/build/emacs/parts/emacs/install/usr/lib -L/build/emacs/parts/emacs/install/lib/x86_64-linux-gnu -L/build/emacs/parts/emacs/install/usr/lib/x86_64-linux-gnu -L/build/emacs/stage/usr/lib'' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Fix-parsing-single-digit-color-codes-in-rcirc.patch >From 178775ce346842f3a6b6baf3945b459cb3e06899 Mon Sep 17 00:00:00 2001 From: Alcor Date: Mon, 25 Aug 2025 21:14:40 +0200 Subject: [PATCH] Fix parsing single-digit color codes in rcirc * lisp/net/rcirc.el (rcirc-color-attributes) (rcirc-remove-markup-codes): Handle single-digit color codes correctly. --- lisp/net/rcirc.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index bfa42ee..a7f1d8b 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -3130,7 +3130,7 @@ indicated by RESPONSE)." "Highlight IRC color-codes, indicated by ASCII control codes." (while (re-search-forward (rx #x03 - (? (group (= 2 digit)) (? "," (group (= 2 digit)))) + (? (group (** 1 2 digit)) (? "," (group (** 1 2 digit)))) (*? nonl) (or #x03 #x0f eol)) nil t) @@ -3151,7 +3151,7 @@ indicated by RESPONSE)." "Remove ASCII control codes used to designate markup." (while (re-search-forward (rx (or #x02 #x1d #x1f #x1e #x11 #x0f - (: #x03 (? (= 2 digit) (? "," (= 2 digit)))))) + (: #x03 (? (** 1 2 digit) (? "," (** 1 2 digit)))))) nil t) (delete-region (match-beginning 0) (match-end 0)))) -- 2.43.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 26 06:56:32 2025 Received: (at 79312) by debbugs.gnu.org; 26 Aug 2025 10:56:32 +0000 Received: from localhost ([127.0.0.1]:54376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uqrLr-0005oS-Uy for submit@debbugs.gnu.org; Tue, 26 Aug 2025 06:56:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40162) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uqrLk-0005nz-Ia for 79312@debbugs.gnu.org; Tue, 26 Aug 2025 06:56:27 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uqrLa-0002Gu-1e; Tue, 26 Aug 2025 06:56:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=qyJ/ZSrVI0QgfgRw4zLjcAj8/+JTrehng+pM15DDmM4=; b=fG/dblodbxIV xP1yrn+qufG7K2bunjILPfBcqPxHxvktCMWOHsmVGAUuAR+DLUKtU3knKes77U5I48pGOp9pewSMs yqVfe7ME5kB/BFeGJyijxlZb2aTrAZfO8ikWDugeqEyth5bMeaVKmECGDIip18StXuYU5R/3f4c8o NMI2yuq14hllXVfj7wxBNIh+nEEOCzOJ+UGBw2nkzXYEr1fV3/sJF3nI+FGHtwC3Cex++nV9p0qSa dNE7JEz9QKn5AITuLfb1GL8Y1vooO53f7s3RZgUgBdzkM2uJ7Se7kxPl1nJ3A3VrXaLEljck37OGd rrjYIHsfYuHlqN4xxE9KHA==; Date: Tue, 26 Aug 2025 13:56:09 +0300 Message-Id: <86seheuzau.fsf@gnu.org> From: Eli Zaretskii To: Alcor , Ryan Yeske , Leo Liu , Philip Kaludercic In-Reply-To: <87y0r7p5gq.fsf@tilde.club> (bug-gnu-emacs@gnu.org) Subject: Re: bug#79312: [PATCH] Fix parsing single-digit color codes in rcirc References: <87y0r7p5gq.fsf@tilde.club> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79312 Cc: 79312@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Mon, 25 Aug 2025 21:27:17 +0200 > From: Alcor via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > Tags: patch > > According to https://modern.ircdocs.horse/formatting#color IRC color > codes may consist of a single digit, e.g. ^C3IRC^C. > > See https://modern.ircdocs.horse/formatting#examples for further > examples. > > The provided two-liner patch relaxes the regexps used for parsing > accordingly so that the single-digit case is supported. Thanks, I added the relevant people to the discussion. > >From 178775ce346842f3a6b6baf3945b459cb3e06899 Mon Sep 17 00:00:00 2001 > From: Alcor > Date: Mon, 25 Aug 2025 21:14:40 +0200 > Subject: [PATCH] Fix parsing single-digit color codes in rcirc > > * lisp/net/rcirc.el (rcirc-color-attributes) > (rcirc-remove-markup-codes): Handle single-digit color codes correctly. > --- > lisp/net/rcirc.el | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el > index bfa42ee..a7f1d8b 100644 > --- a/lisp/net/rcirc.el > +++ b/lisp/net/rcirc.el > @@ -3130,7 +3130,7 @@ indicated by RESPONSE)." > "Highlight IRC color-codes, indicated by ASCII control codes." > (while (re-search-forward > (rx #x03 > - (? (group (= 2 digit)) (? "," (group (= 2 digit)))) > + (? (group (** 1 2 digit)) (? "," (group (** 1 2 digit)))) > (*? nonl) > (or #x03 #x0f eol)) > nil t) > @@ -3151,7 +3151,7 @@ indicated by RESPONSE)." > "Remove ASCII control codes used to designate markup." > (while (re-search-forward > (rx (or #x02 #x1d #x1f #x1e #x11 #x0f > - (: #x03 (? (= 2 digit) (? "," (= 2 digit)))))) > + (: #x03 (? (** 1 2 digit) (? "," (** 1 2 digit)))))) > nil t) > (delete-region (match-beginning 0) (match-end 0)))) > > -- > 2.43.0 >