From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 03 19:00:28 2022 Received: (at submit) by debbugs.gnu.org; 4 Dec 2022 00:00:28 +0000 Received: from localhost ([127.0.0.1]:54053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1cQl-0003eN-RG for submit@debbugs.gnu.org; Sat, 03 Dec 2022 19:00:28 -0500 Received: from lists.gnu.org ([209.51.188.17]:34612) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p1cQk-0003eH-QE for submit@debbugs.gnu.org; Sat, 03 Dec 2022 19:00:27 -0500 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 1p1cQk-00035X-5O for bug-gnu-emacs@gnu.org; Sat, 03 Dec 2022 19:00:26 -0500 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p1cQi-0006Kd-7k for bug-gnu-emacs@gnu.org; Sat, 03 Dec 2022 19:00:25 -0500 Received: by mail-ej1-x62b.google.com with SMTP id td2so19615857ejc.5 for ; Sat, 03 Dec 2022 16:00:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=/Xkmg+ydBtd1TzeeN3DC665RLp4FArQiDAavLN89Ljg=; b=Utz5df+gT51cD6fUZNnb39MVRHhOZ8wCBeEhPQyZ1FEg2pgL0D0DccWOFaxpkcSSSb HA0KgXqcPwDxKHSaEFyFjeSLqI8/k+ZnUpf+QUf6b5/b63/5P1RJKWwnDY/0g6p5ANT/ Bkh0ZDKwwCSf+fnWJdnZV+nORopDUTUiM4g8dOkUbju/uFcLLHPDYno9LS3FDzmd8Zji 8MSwl1CBdE7X8ZokLBH6mEmdK8zIOgSB3H22briyyHddbI++wXKjvaV3tiz9Srwob+eK 46TJ0e/n60535VGl2mlVpLOpNuI2+TfbkK2fWUwPYkF5Q2o0Cz/+X0AeVCsDbD3nTfgn Beyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/Xkmg+ydBtd1TzeeN3DC665RLp4FArQiDAavLN89Ljg=; b=dtJJLICuT/PpDG3pYyLshWm4lEMUaIlnffQmRoAyzBWGMjRaVF0Uyrh8sKtMRmX3wm 24CFinPXFLrH1yqnEoqATfulLHQtyuUx9g9ik9MinsJqacWbEpFL+8DccfBC+EwrC/Ua kPLic8hktubRXV+o2xKpuuQSLbM2nQ5epUXNX0X5mq6p2J1FBiTsVEcCkWXYxkcJ7q1F XufKypCnxWURlDlPuHQ84tUK5w5zd8B3W8NkNgQcn3PQFP0vZS1MjEFCgZ4F9wA9YwzE V5z29qguG0FZjnFCkIyf2hCifd1arfomCbOqADLsFmt1dNRndv1rbh4xBaDwyXOjjLhe aY4Q== X-Gm-Message-State: ANoB5pnXL+IgXNuTc0Kv59eMyHwaLSTeF/XKidUvtqLaoO9+w1hZ8Doo Zshke0DEx4R7/P24WLy+EiybnYhM+iM= X-Google-Smtp-Source: AA0mqf5TZDKSSFzPFPhs7i77OSA8n809m5TWoQDtt3uOrvr/C2qO/VPgQ+ET9kFkkP2DnJ4LFYSbqA== X-Received: by 2002:a17:906:be9:b0:78d:3e11:1036 with SMTP id z9-20020a1709060be900b0078d3e111036mr65918121ejg.76.1670112021534; Sat, 03 Dec 2022 16:00:21 -0800 (PST) Received: from thuna (eduroam-189.unibocconi.it. [90.147.70.189]) by smtp.gmail.com with ESMTPSA id p23-20020aa7d317000000b00461cdda400esm4633965edq.4.2022.12.03.16.00.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Dec 2022 16:00:20 -0800 (PST) From: Thuna To: bug-gnu-emacs@gnu.org Subject: [PATCH] Fix rcirc-markup-text-functions applying to the whole message Date: Sun, 04 Dec 2022 01:00:19 +0100 Message-ID: <87tu2cnilo.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=thuna.cing@gmail.com; helo=mail-ej1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-rcirc-markup-text-functions-applying-to-the-whol.patch Content-Description: the patch >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)) + (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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon May 01 08:02:10 2023 Received: (at 59810) by debbugs.gnu.org; 1 May 2023 12:02:10 +0000 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 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 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== 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) From: Philip Kaludercic To: Thuna Subject: Re: bug#59810: [PATCH] Fix rcirc-markup-text-functions applying to the whole message In-Reply-To: <87tu2cnilo.fsf@gmail.com> (Thuna's message of "Sun, 04 Dec 2022 01:00:19 +0100") References: <87tu2cnilo.fsf@gmail.com> 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 Date: Mon, 01 May 2023 12:02:35 +0000 Message-ID: <878re8qmxw.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59810 Cc: 59810@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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)))) From debbugs-submit-bounces@debbugs.gnu.org Mon May 01 16:32:55 2023 Received: (at 59810) by debbugs.gnu.org; 1 May 2023 20:32:55 +0000 Received: from localhost ([127.0.0.1]:41144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ptaCd-0005cv-9r for submit@debbugs.gnu.org; Mon, 01 May 2023 16:32:55 -0400 Received: from mail-ed1-f43.google.com ([209.85.208.43]:50629) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ptaCX-0005cg-Nb for 59810@debbugs.gnu.org; Mon, 01 May 2023 16:32:53 -0400 Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-50bc5197d33so2774700a12.1 for <59810@debbugs.gnu.org>; Mon, 01 May 2023 13:32:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682973163; x=1685565163; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=CdpHt/eIZ50Wmeoz/LG9rAtdyjT6RiOYCuc5g4L1jVE=; b=HjVpVSHneTa00Lr/Y7EIGe9YXyGXrhU1cIXbzNMR4g/PVzmH0nJIqW7xkOBLSG/zhb 3SqzqLaboEPwZpjyYwPiKnqRbEE29o/GjqXqPGK0Qua5hfLTUIBsrZg9+nmcl4kzMBQb E0SZHdAqac3ymO+2YawRXWIHGN/2lb4ahXHR1UfPvHk/RAyBUGyZH2j7fKlja1VlxSMR 4IYXFBiX+lSJtc7HMQ4k6kQJT629HwXh/n0xNFLKxbAWvspRqHjaCLCTtvkzqzN/wosY CWB3L7Gxsm0NvHEHrKDwCM4OUDGLwfU2P5l6vJI8cvK3gavavgoSuJg1kuMcyCvfWZBg UBDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682973163; x=1685565163; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CdpHt/eIZ50Wmeoz/LG9rAtdyjT6RiOYCuc5g4L1jVE=; b=SeOXf7FfeCXB7HwQ7urS4LhfX4y5y40eM6cgoZcfAe0xpDpaiBOGZ5MpueqB9DZ5OD CgmTOHaidECKSQb3BZpwHzLGYQH05fJstcacFjFoXFcIBQ4bQZ6UOmallSMkusatzpAu i9e7QS9nhudIjUIQK4dTLwSgMz0bb9TocPsOxHJtiA5/z2BtnRfK05VxkU4y+YHOYWzT 38sat8sFjJsxPqva8c7WK2kDYIZtrx3trGXB3n3c3uSmhGZA7YVGhkTGli6Sf1YuxncX R76Ag6VXpKPFaULoCSZazD/he5k3crkn/UMttjHtRbZqKks2zpkQ0NlvT9TqRDxY2353 Y2HQ== X-Gm-Message-State: AC+VfDw8G1X6k3G2CLWX+o6/77lNvh79D0RnC6Dq39vM010K+UaeYjOM inkf9DNiiSM9iHNdjVgVq07Qcd6CXRQ= X-Google-Smtp-Source: ACHHUZ4agaaGPHgr0VNZU1Aa6mVP/0ru6EYjrSHkJ9D47Y8C0yrolIkjVm4p+tVLHX7cBs/8voFBIw== X-Received: by 2002:a05:6402:42:b0:50b:cd70:8015 with SMTP id f2-20020a056402004200b0050bcd708015mr795712edu.17.1682973163404; Mon, 01 May 2023 13:32:43 -0700 (PDT) Received: from thuna (eduroam-063.unibocconi.it. [90.147.70.63]) by smtp.gmail.com with ESMTPSA id by5-20020a0564021b0500b0050bce352dc5sm272650edb.85.2023.05.01.13.32.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 13:32:42 -0700 (PDT) From: Thuna To: Philip Kaludercic Subject: Re: bug#59810: [PATCH] Fix rcirc-markup-text-functions applying to the whole message In-Reply-To: <878re8qmxw.fsf@posteo.net> References: <87tu2cnilo.fsf@gmail.com> <878re8qmxw.fsf@posteo.net> Date: Mon, 01 May 2023 22:32:41 +0200 Message-ID: <87ildbeqs6.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59810 Cc: 59810@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > >> 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.