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

Full log


View this message in rfc822 format

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: 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 11 days ago.

Previous Next


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