* bug#59810: [PATCH] Fix rcirc-markup-text-functions applying to the whole message
@ 2022-12-04 0:00 Thuna
2023-05-01 12:02 ` Philip Kaludercic
0 siblings, 1 reply; 3+ messages in thread
From: Thuna @ 2022-12-04 0:00 UTC (permalink / raw)
To: 59810
[-- Attachment #1: Type: text/plain, Size: 628 bytes --]
Since `rcirc-markup-text-functions' is meant to apply only to the text,
the changed code, which applied it to the entirety of the message was
bugged. The simplest example is `\me NICK' with `rcirc-color', where
NICK is supposed to be colored but isn't because the message reads
`[... NICK]' and the `]' is recognized as a part of the nick.
The patch should fix the issue, although it is possible that some
already existing functions put to `rcirc-markup-text-functions' will
break due to them expecting the previous behavior. I still propose the
patch is applied as the issue is a bug on those functions' end and not
rcirc.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: the patch --]
[-- Type: text/x-patch, Size: 1468 bytes --]
From ae0334e422f84941218acdd0a953b6f1f2d34fac Mon Sep 17 00:00:00 2001
From: Thuna <thuna.cing@gmail.com>
Date: Sun, 4 Dec 2022 00:42:37 +0100
Subject: [PATCH] Fix `rcirc-markup-text-functions' applying to the whole
message
* lisp/net/rcirc.el (rcirc-print): Apply `rcirc-markup-text-functions'
only to the text part of the message.
---
lisp/net/rcirc.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 1fdf41a35ee..96109dcd5c9 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -2080,8 +2080,13 @@ rcirc-print
(point)))
(when (rcirc-buffer-process)
(save-excursion (rcirc-markup-timestamp sender response))
- (dolist (fn rcirc-markup-text-functions)
- (save-excursion (funcall fn sender response)))
+ (save-restriction
+ (when-let ((prop-match (text-property-search-forward 'rcirc-text)))
+ (goto-char (prop-match-beginning prop-match))
+ (narrow-to-region (prop-match-beginning prop-match)
+ (prop-match-end prop-match))
+ (dolist (fn rcirc-markup-text-functions)
+ (save-excursion (funcall fn sender response)))))
(when rcirc-fill-flag
(save-excursion (rcirc-markup-fill sender response))))
--
2.37.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#59810: [PATCH] Fix rcirc-markup-text-functions applying to the whole message
2022-12-04 0:00 bug#59810: [PATCH] Fix rcirc-markup-text-functions applying to the whole message Thuna
@ 2023-05-01 12:02 ` Philip Kaludercic
2023-05-01 20:32 ` Thuna
0 siblings, 1 reply; 3+ messages in thread
From: Philip Kaludercic @ 2023-05-01 12:02 UTC (permalink / raw)
To: Thuna; +Cc: 59810
Thuna <thuna.cing@gmail.com> writes:
> Since `rcirc-markup-text-functions' is meant to apply only to the text,
> the changed code, which applied it to the entirety of the message was
> bugged. The simplest example is `\me NICK' with `rcirc-color', where
> NICK is supposed to be colored but isn't because the message reads
> `[... NICK]' and the `]' is recognized as a part of the nick.
I can not reproduce this, can you give a different example?
> The patch should fix the issue, although it is possible that some
> already existing functions put to `rcirc-markup-text-functions' will
> break due to them expecting the previous behavior. I still propose the
> patch is applied as the issue is a bug on those functions' end and not
> rcirc.
>
>>From ae0334e422f84941218acdd0a953b6f1f2d34fac Mon Sep 17 00:00:00 2001
> From: Thuna <thuna.cing@gmail.com>
> Date: Sun, 4 Dec 2022 00:42:37 +0100
> Subject: [PATCH] Fix `rcirc-markup-text-functions' applying to the whole
> message
>
> * lisp/net/rcirc.el (rcirc-print): Apply `rcirc-markup-text-functions'
> only to the text part of the message.
> ---
> lisp/net/rcirc.el | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
> index 1fdf41a35ee..96109dcd5c9 100644
> --- a/lisp/net/rcirc.el
> +++ b/lisp/net/rcirc.el
> @@ -2080,8 +2080,13 @@ rcirc-print
> (point)))
> (when (rcirc-buffer-process)
> (save-excursion (rcirc-markup-timestamp sender response))
> - (dolist (fn rcirc-markup-text-functions)
> - (save-excursion (funcall fn sender response)))
> + (save-restriction
> + (when-let ((prop-match (text-property-search-forward 'rcirc-text)))
> + (goto-char (prop-match-beginning prop-match))
> + (narrow-to-region (prop-match-beginning prop-match)
> + (prop-match-end prop-match))
Why is this necessary, if the only function that would have modified the
buffer gap is `rcirc-markup-timestamp'?
> + (dolist (fn rcirc-markup-text-functions)
> + (save-excursion (funcall fn sender response)))))
> (when rcirc-fill-flag
> (save-excursion (rcirc-markup-fill sender response))))
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#59810: [PATCH] Fix rcirc-markup-text-functions applying to the whole message
2023-05-01 12:02 ` Philip Kaludercic
@ 2023-05-01 20:32 ` Thuna
0 siblings, 0 replies; 3+ messages in thread
From: Thuna @ 2023-05-01 20:32 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: 59810
>
>> Since `rcirc-markup-text-functions' is meant to apply only to the text,
>> the changed code, which applied it to the entirety of the message was
>> bugged. The simplest example is `\me NICK' with `rcirc-color', where
>> NICK is supposed to be colored but isn't because the message reads
>> `[... NICK]' and the `]' is recognized as a part of the nick.
>
> I can not reproduce this, can you give a different example?
Nothing else immediately comes to mind, unfortunately. I am able to
reproduce it, however:
- emacs -Q
- Load rcirc-color (version 0.4.5 as of now)
- M-x rcirc
- /query fsbot (assuming you're in libera.chat)
- Type a message so that fsbot responds and its color is registered
- "/me fsbot" --- You will see that fsbot is not colored
- "/me fsbot " --- You will see that fsbot is colored
My emacs version is GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu,
GTK+ Version 3.24.34) of 2023-01-09, in case that matters.
>> The patch should fix the issue, although it is possible that some
>> already existing functions put to `rcirc-markup-text-functions' will
>> break due to them expecting the previous behavior. I still propose the
>> patch is applied as the issue is a bug on those functions' end and not
>> rcirc.
> Why is this necessary, if the only function that would have modified the
> buffer gap is `rcirc-markup-timestamp'?
I do not understand what you are referring to here.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-01 20:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-04 0:00 bug#59810: [PATCH] Fix rcirc-markup-text-functions applying to the whole message Thuna
2023-05-01 12:02 ` Philip Kaludercic
2023-05-01 20:32 ` Thuna
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).