GNU bug report logs - #79312
[PATCH] Fix parsing single-digit color codes in rcirc

Previous Next

Package: emacs;

Reported by: Alcor <alcor <at> tilde.club>

Date: Mon, 25 Aug 2025 19:29:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 79312 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79312; Package emacs. (Mon, 25 Aug 2025 19:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alcor <alcor <at> tilde.club>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 25 Aug 2025 19:29:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alcor <alcor <at> tilde.club>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix parsing single-digit color codes in rcirc
Date: Mon, 25 Aug 2025 21:27:17 +0200
[Message part 1 (text/plain, inline)]
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''

[0001-Fix-parsing-single-digit-color-codes-in-rcirc.patch (text/patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79312; Package emacs. (Tue, 26 Aug 2025 10:57:01 GMT) Full text and rfc822 format available.

Message #8 received at 79312 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alcor <alcor <at> tilde.club>, Ryan Yeske <rcyeske <at> gmail.com>,
 Leo Liu <sdl.web <at> gmail.com>, Philip Kaludercic <philipk <at> posteo.net>
Cc: 79312 <at> debbugs.gnu.org
Subject: Re: bug#79312: [PATCH] Fix parsing single-digit color codes in rcirc
Date: Tue, 26 Aug 2025 13:56:09 +0300
> Date: Mon, 25 Aug 2025 21:27:17 +0200
> From:  Alcor via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> 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 <alcor <at> tilde.club>
> 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
> 




This bug report was last modified 10 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.