From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Amin Bandali Newsgroups: gmane.emacs.bugs Subject: bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens) Date: Sat, 28 Dec 2019 23:30:19 -0500 Message-ID: <87k16feotg.fsf@gnu.org> References: <87v9rhkxa9.fsf@gnu.org> <87r225kwvv.fsf@gnu.org> <875zjfrslq.fsf@gnu.org> <87imndxr6i.fsf@gnus.org> <87pnhk90tn.fsf@gnu.org> <875zjct7xd.fsf@gnus.org> <87eey06n8c.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="64573"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 38257@debbugs.gnu.org, Emanuel Berg To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 29 05:31:17 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ilQEW-000Ge8-N2 for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Dec 2019 05:31:17 +0100 Original-Received: from localhost ([::1]:49194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilQET-00038m-VB for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Dec 2019 23:31:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60606) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilQEK-00035r-8w for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2019 23:31:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ilQEI-0000Kg-Fg for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2019 23:31:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53187) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ilQEI-0000JU-AJ for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2019 23:31:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ilQEI-0005FK-79 for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2019 23:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Amin Bandali Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Dec 2019 04:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38257 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 38257-submit@debbugs.gnu.org id=B38257.157759383720132 (code B ref 38257); Sun, 29 Dec 2019 04:31:02 +0000 Original-Received: (at 38257) by debbugs.gnu.org; 29 Dec 2019 04:30:37 +0000 Original-Received: from localhost ([127.0.0.1]:59160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ilQDs-0005Ed-Km for submit@debbugs.gnu.org; Sat, 28 Dec 2019 23:30:37 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50367) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ilQDr-0005ES-Il for 38257@debbugs.gnu.org; Sat, 28 Dec 2019 23:30:36 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:42742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ilQDm-0007Oh-4y; Sat, 28 Dec 2019 23:30:30 -0500 Original-Received: from [2607:fea8:3b80:1ea:2dee:350a:2909:a36d] (port=46992 helo=localhost) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ilQDd-00085G-IP; Sat, 28 Dec 2019 23:30:28 -0500 In-Reply-To: <87eey06n8c.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:173872 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Amin Bandali writes: > Lars Ingebrigtsen writes: > > [...] >> >> So I think for this to work with erc, I think >> it would make sense to separate out the URL >> recognition in erc from other buttons, and >> base it on browse-url-button-regexp instead, >> which has worked out these kinks and is >> pretty DWIM. >> >> And then you can change the syntax table to >> make the other, simpler buttons (for nicks >> etc) work. > > Nice, I think that would make sense. FWIW, I'm > not familiar with how ERC does URL recognition > either, but I'll try to look into it soon-ish. > In the mean time, if anyone else is familiar > with this already, your help would be much > appreciated. :) > So I had a bit of time on my hands again, and looked into erc-button per Lars=E2=80=99s suggestion. Turns out there=E2=80=99s a C-h v erc-button-ur= l-regexp RET. Replacing it with C-h v browse-url-button-regexp RET seems to improve things with surrounding pair of parens. In particular, the closing paren isn=E2=80=99t wrongly buttonized anymore, which is nice. I think the only nice-to-have at this point would be if quotes without a matching one were buttonized as part of the address, e.g. the one from Lars=E2=80=99s earlier example. For instance, currently in all the following examples buttonizing ends right before the quote (i.e. the t is the last clickable character): =2D https://example.org/test"x =2D https://example.org/test'x =2D https://example.org/test=E2=80=99x =2D https://example.org/test" =2D https://example.org/test' =2D https://example.org/test=E2=80=99 Note that the current behaviour is *not* a side-effect of my patch. > > Also, I'll keep on using my patch on my local > checkout and will report back if I notice any > serious issues. So far it's been working > pretty nicely here, minus the URL buttons. > Quick update: I=E2=80=99ve been using my patch every day for the past ~40 d= ays, and I haven=E2=80=99t had any issues with it so far. * * * Finally, the updated patch (against master, but I=E2=80=99m hoping since it hasn=E2=80=99t diverged from emacs-27 much yet, it should still apply there= ): --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0001-Improve-ERC-s-matching-of-nicks-and-URLs-bug-38257.patch Content-Transfer-Encoding: quoted-printable From=20940d5e41ad5449bf0b0214b941de54ebbd5df546 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Mon, 18 Nov 2019 10:24:48 -0500 Subject: [PATCH v2] Improve ERC's matching of nicks and URLs (bug#38257) MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * lisp/erc/erc-{button,match}.el (erc-{button,match}-syntax-table): Omit (, ), and '; as they're not valid nick characters, per RFC 2812 section 2.3.1. This enables correct matching/highlighting of nicks when they=E2=80=99re surrounded by parens, like (nick), and when adjacent to an apostrophy, like nick's. * lisp/erc/erc-button.el (erc-button-url-regexp): Use the regexp from browse-url-button-regexp, which among other things, seems to handle surrounding pair of parens better. =2D-- lisp/erc/erc-button.el | 11 +++-------- lisp/erc/erc-match.el | 3 --- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index ec70260146..ae7a6e6bf3 100644 =2D-- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -41,6 +41,7 @@ (require 'erc) (require 'wid-edit) (require 'erc-fill) +(require 'browse-url) =20 ;;; Minor Mode =20 @@ -87,12 +88,9 @@ erc-button-mouse-face :type 'face :group 'erc-faces) =20 =2D(defcustom erc-button-url-regexp =2D (concat "\\(www\\.\\|\\(s?https?\\|" =2D "ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\)" =2D "\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?" =2D "[-a-zA-Z0-9_=3D!?#$@~`%&*+\\/:;.,()]+[-a-zA-Z0-9_=3D#$@~`%&*+= \\/()]") +(defcustom erc-button-url-regexp browse-url-button-regexp "Regular expression that matches URLs." + :version "27.1" :group 'erc-button :type 'regexp) =20 @@ -223,14 +221,11 @@ erc-button-keymap =20 (defvar erc-button-syntax-table (let ((table (make-syntax-table))) =2D (modify-syntax-entry ?\( "w" table) =2D (modify-syntax-entry ?\) "w" table) (modify-syntax-entry ?\[ "w" table) (modify-syntax-entry ?\] "w" table) (modify-syntax-entry ?\{ "w" table) (modify-syntax-entry ?\} "w" table) (modify-syntax-entry ?` "w" table) =2D (modify-syntax-entry ?' "w" table) (modify-syntax-entry ?^ "w" table) (modify-syntax-entry ?- "w" table) (modify-syntax-entry ?_ "w" table) diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el index e9ed735516..336040a374 100644 =2D-- a/lisp/erc/erc-match.el +++ b/lisp/erc/erc-match.el @@ -246,14 +246,11 @@ erc-match-exclude-server-buffer ;; just put it in erc.el (defvar erc-match-syntax-table (let ((table (make-syntax-table))) =2D (modify-syntax-entry ?\( "w" table) =2D (modify-syntax-entry ?\) "w" table) (modify-syntax-entry ?\[ "w" table) (modify-syntax-entry ?\] "w" table) (modify-syntax-entry ?\{ "w" table) (modify-syntax-entry ?\} "w" table) (modify-syntax-entry ?` "w" table) =2D (modify-syntax-entry ?' "w" table) (modify-syntax-entry ?^ "w" table) (modify-syntax-entry ?- "w" table) (modify-syntax-entry ?_ "w" table) =2D-=20 2.23.0 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable =2D-=20 Amin Bandali Free Software Activist | GNU Maintainer & Webmaster GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103 https://bandali.eu.org --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJEBAEBCAAuFiEEObM8jZRIDS3cwqSYi0Sgzce5VvIFAl4IK9sQHGJhbmRhbGlA Z251Lm9yZwAKCRCLRKDNx7lW8ttcD/9n6k0Dehe1fxoDrQwNg4xnAi+2UR/RxYtk snTDDJ+mkixTR5TNdJLM2kTyeMFurG5yIikdeQSEF9Lebwcm7Zwy0I2GQaZxrXHJ cnu27N+kWDnobdnedg/sIbYHJM+TrmjcCbB3ghhRWZZCEKYiAasWkf7OP6En8kvF hwgyXFTGsQ7DZncai0mKzpIRZFzdzAAeLTwyNDlrybt4rbDjbJy+ytZthmxLwszW 0k3BFg4iLB035LDXK0pIl8ORWfmHP5R5QhEZYj7SjI9uVOfJmtyGubutpG2Vm4qD YJUqLUU4gjU3mIAoWGkR174gXLa+pYd2jqNvMxO/CUK6JnUN8OXws9u2dUtoEW4C nJ34ehqBDmtuPECBZeIVgWfE8YjCXexJSx4HWC5KzxFHe9eWt+lpM4F1nC2jnnBf 0dPEjD5dT+zsDHmirhhq+a1OBT5WZvfnCP15NOtQiDlpacUWVOw3Kqj5ZENt6W7v JXZu/oTQ1dziSHluKDqGvgx/kplt6NAVq2uoMOwPTwXsn6NFJbdUd0M1CwKCZ+kb 1BCkWm6kq0QVIoYGM4bFgUCaW9qadG/38WPfK282JQy/3juqTUrv17dm9QzEVRsm E122n7f5gz51p6TFYrhlyMLvo3F9fjGVdgLioNtSf4PVAysmJBlpgUfGPKtQ1eaj avZYr9rW4Q== =gt62 -----END PGP SIGNATURE----- --==-=-=--