From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#59810: [PATCH] Fix rcirc-markup-text-functions applying to the whole message Date: Mon, 01 May 2023 12:02:35 +0000 Message-ID: <878re8qmxw.fsf@posteo.net> References: <87tu2cnilo.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5302"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59810@debbugs.gnu.org To: Thuna Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 01 14:03:31 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ptSFf-0001Cg-5l for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 May 2023 14:03:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ptSFO-0002Tz-I6; Mon, 01 May 2023 08:03:14 -0400 Original-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 1ptSFF-0002PJ-4t for bug-gnu-emacs@gnu.org; Mon, 01 May 2023 08:03:11 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ptSFC-00055k-Eh for bug-gnu-emacs@gnu.org; Mon, 01 May 2023 08:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ptSFB-0004Kj-WC for bug-gnu-emacs@gnu.org; Mon, 01 May 2023 08:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 May 2023 12:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59810 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 59810-submit@debbugs.gnu.org id=B59810.168294253016577 (code B ref 59810); Mon, 01 May 2023 12:03:01 +0000 Original-Received: (at 59810) by debbugs.gnu.org; 1 May 2023 12:02:10 +0000 Original-Received: from localhost ([127.0.0.1]:39063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ptSEM-0004JI-1m for submit@debbugs.gnu.org; Mon, 01 May 2023 08:02:10 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:51129) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ptSEK-0004Iy-RE for 59810@debbugs.gnu.org; Mon, 01 May 2023 08:02:09 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 53F3324011B for <59810@debbugs.gnu.org>; Mon, 1 May 2023 14:02:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1682942523; bh=h1fZsITG4WwAYKFugF8PA9LwD7ArPwSROKZsfhhIsb4=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=FcEoMbq1sImSe+BQuljrzKDM4gXPSrnNu+x+GFidlI2qk/ie+vhdVHJAPLys3bKMk LlBHkIWiFwplyv89r05RLKNtMt+UCGIxQmuDI/D2Eiz4i1zr+CtfXFFZvXHT7oPFvF pniOHGhjHSSNYqcD9jdG5ck7XYyzYSHSEoXSlIqUswFildthnMiGd1cWZJ1tIqNSiP aF5fiOJeFZmRmEp9DBVrO6iuEIrsXsfjl7h4FnggjopHau8SIxk8kwCql9jSWfri0M 1NIQ8WXAtdelAk3x6QuiFvkQrJTMdJvewDvYO3xu7nHfp5iM2xsx+ZiG/ZJJVYDZSC JD06JqPejl4bg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Q91zG6bgtz6twy; Mon, 1 May 2023 14:02:02 +0200 (CEST) In-Reply-To: <87tu2cnilo.fsf@gmail.com> (Thuna's message of "Sun, 04 Dec 2022 01:00:19 +0100") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:260857 Archived-At: Thuna 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 > 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))))