From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thuna Newsgroups: gmane.emacs.bugs Subject: bug#59810: [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="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35193"; mail-complaints-to="usenet@ciao.gmane.io" To: 59810@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 04 01:01:32 2022 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 1p1cRo-0008vd-9k for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Dec 2022 01:01:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1cRU-0003DS-5N; Sat, 03 Dec 2022 19:01:12 -0500 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 1p1cRQ-0003D6-Dt for bug-gnu-emacs@gnu.org; Sat, 03 Dec 2022 19:01:08 -0500 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 1p1cRK-0006Ol-RK for bug-gnu-emacs@gnu.org; Sat, 03 Dec 2022 19:01:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p1cRK-0003ey-6C for bug-gnu-emacs@gnu.org; Sat, 03 Dec 2022 19:01:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Thuna Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Dec 2022 00:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59810 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167011202814039 (code B ref -1); Sun, 04 Dec 2022 00:01:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Dec 2022 00:00:28 +0000 Original-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 Original-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 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 1p1cQk-00035X-5O for bug-gnu-emacs@gnu.org; Sat, 03 Dec 2022 19:00:26 -0500 Original-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 Original-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) Original-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) 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-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:249888 Archived-At: --=-=-= 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 --=-=-=--