From: Thuna <thuna.cing@gmail.com>
To: 59810@debbugs.gnu.org
Subject: bug#59810: [PATCH] Fix rcirc-markup-text-functions applying to the whole message
Date: Sun, 04 Dec 2022 01:00:19 +0100 [thread overview]
Message-ID: <87tu2cnilo.fsf@gmail.com> (raw)
[-- 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
next reply other threads:[~2022-12-04 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-04 0:00 Thuna [this message]
2023-05-01 12:02 ` bug#59810: [PATCH] Fix rcirc-markup-text-functions applying to the whole message Philip Kaludercic
2023-05-01 20:32 ` Thuna
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tu2cnilo.fsf@gmail.com \
--to=thuna.cing@gmail.com \
--cc=59810@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.