GNU bug report logs - #38257
27.0.50; ERC does not match or highlight nick surrounded by parens

Previous Next

Package: emacs;

Reported by: Amin Bandali <bandali <at> gnu.org>

Date: Mon, 18 Nov 2019 15:41:02 UTC

Severity: minor

Tags: patch

Merged with 38366

Found in versions 25.1, 27.0.50

Fixed in version 27.1

Done: Amin Bandali <bandali <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38257 in the body.
You can then email your comments to 38257 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Mon, 18 Nov 2019 15:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Amin Bandali <bandali <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 18 Nov 2019 15:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Amin Bandali <bandali <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; ERC does not match or highlight nick surrounded by parens
Date: Mon, 18 Nov 2019 10:40:46 -0500
As the title says, ERC currently does not match
or highlight nicks when surrounded by a pair of
parens.  This has resulted in me not getting
notified of several important messages and
missing them.

I’ll send a patch fixing this shortly.

-- 
Amin Bandali
Free Software Activist | GNU Maintainer & Webmaster
GPG: BE62 7373 8E61 6D6D 1B3A  08E8 A21A 0202 4881 6103
https://bandali.eu.org




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Mon, 18 Nov 2019 15:50:02 GMT) Full text and rfc822 format available.

Message #8 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Amin Bandali <bandali <at> gnu.org>
To: 38257 <at> debbugs.gnu.org
Subject: Re: bug#38257: Acknowledgement (27.0.50; ERC does not match or
 highlight nick surrounded by parens)
Date: Mon, 18 Nov 2019 10:49:24 -0500
[Message part 1 (text/plain, inline)]
Here’s a patch that fixes the issue for me:

[0001-Fix-ERC-not-matching-nicks-surrounded-parens-bug-38257.patch (text/x-diff, inline)]
From 10f1fb7ccfb3e76dbd5df44f3f0e2780d24ba99b Mon Sep 17 00:00:00 2001
From: Amin Bandali <bandali <at> gnu.org>
Date: Mon, 18 Nov 2019 10:24:48 -0500
Subject: [PATCH] Fix ERC not matching nicks surrounded parens (bug#38257)

* lisp/erc/erc-{button,match}.el (erc-{button,match}-syntax-table):
Omit parens, as they're not valid nick characters, per RFC 2812
section 2.3.1.
---
 lisp/erc/erc-button.el | 2 --
 lisp/erc/erc-match.el  | 2 --
 2 files changed, 4 deletions(-)

diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index ec70260146..3dc4e92a46 100644
--- a/lisp/erc/erc-button.el
+++ b/lisp/erc/erc-button.el
@@ -223,8 +223,6 @@ erc-button-keymap
 
 (defvar erc-button-syntax-table
   (let ((table (make-syntax-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)
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index e9ed735516..e87076dbe3 100644
--- a/lisp/erc/erc-match.el
+++ b/lisp/erc/erc-match.el
@@ -246,8 +246,6 @@ erc-match-exclude-server-buffer
 ;; just put it in erc.el
 (defvar erc-match-syntax-table
   (let ((table (make-syntax-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)
-- 
2.23.0


Added tag(s) patch. Request was from Amin Bandali <bandali <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 18 Nov 2019 15:54:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Wed, 20 Nov 2019 06:05:01 GMT) Full text and rfc822 format available.

Message #13 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Amin Bandali <bandali <at> gnu.org>
To: 38257 <at> debbugs.gnu.org
Subject: Re: bug#38257: Acknowledgement (27.0.50; ERC does not match or
 highlight nick surrounded by parens)
Date: Wed, 20 Nov 2019 01:04:33 -0500
[Message part 1 (text/plain, inline)]
Here’s a v2 that fixes the issue for
apostrophes as well, with a slightly tweaked
commit message.

[0001-Improve-ERC-s-matching-of-nicks-bug-38257.patch (text/x-diff, inline)]
From 1185e528641cbce618db93aa6604899e79300522 Mon Sep 17 00:00:00 2001
From: Amin Bandali <bandali <at> gnu.org>
Date: Mon, 18 Nov 2019 10:24:48 -0500
Subject: [PATCH v2] Improve ERC's matching of nicks (bug#38257)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-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’re surrounded by parens, like (nick), and when adjacent to
an apostrophy, like nick's.
---
 lisp/erc/erc-button.el | 3 ---
 lisp/erc/erc-match.el  | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index ec70260146..002b99520a 100644
--- a/lisp/erc/erc-button.el
+++ b/lisp/erc/erc-button.el
@@ -223,14 +223,11 @@ erc-button-keymap
 
 (defvar erc-button-syntax-table
   (let ((table (make-syntax-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)
     (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)
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index e9ed735516..336040a374 100644
--- 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)))
-    (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)
     (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)
-- 
2.23.0


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Thu, 21 Nov 2019 14:04:01 GMT) Full text and rfc822 format available.

Message #16 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Amin Bandali <bandali <at> gnu.org>
Cc: 38257 <at> debbugs.gnu.org
Subject: Re: bug#38257: Acknowledgement (27.0.50; ERC does not match or
 highlight nick surrounded by parens)
Date: Thu, 21 Nov 2019 15:03:17 +0100
Amin Bandali <bandali <at> gnu.org> writes:

> * 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’re surrounded by parens, like (nick), and when adjacent to
> an apostrophy, like nick's.

I haven't tried this patch, but doesn't this syntax table apply to all
buttons in erc, including URLs?  So an URL like
http://foo.bar/zot'foo would no longer be recognised properly?  (I'm not
sure that it should, to be honest...)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Thu, 21 Nov 2019 20:40:02 GMT) Full text and rfc822 format available.

Message #19 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Corwin Brust <corwin <at> bru.st>
To: 38257 <at> debbugs.gnu.org
Subject: Missed notif > broken buttons
Date: Thu, 21 Nov 2019 14:17:12 -0600
[Message part 1 (text/plain, inline)]
Chiming in to say that I've applied the patch in my local and I hope it
will be applied/accepted.

The functionality provided by buttons is essentially convenience.  Missing
a notification can have real impact on my life.

Regards,
-- 
*Corwin*
corwin.brust (skype)
*corwin <at> bru.st <corwin <at> bru.st>*
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Fri, 22 Nov 2019 01:07:01 GMT) Full text and rfc822 format available.

Message #22 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Amin Bandali <bandali <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 38257 <at> debbugs.gnu.org
Subject: Re: bug#38257: Acknowledgement (27.0.50; ERC does not match or
 highlight nick surrounded by parens)
Date: Thu, 21 Nov 2019 20:06:28 -0500
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

[...]
>
> I haven't tried this patch, but doesn't this syntax table apply to all
> buttons in erc, including URLs?  So an URL like
> http://foo.bar/zot'foo would no longer be recognised properly?  (I'm not
> sure that it should, to be honest...)

It does indeed, and it didn't quite occur to me
when writing the patch; whoops.

But like Corwin, I too personally much rather
be notified of my nick getting highlighted in
exchange for losing some convenience with
respect to clickable links.

That said, from a brief chat with Tom Tromey in
#erc on freenode today, I agree with him that
one probably shouldn't make changes to syntax
tables lightly, without first considering all
possible cases.  I wonder if you or Tom would
be so kind to do such an audit for this change.
I'd also be open to other ways of doing this if
there's a better way.  I guess in general it is
kind of tricky to deal with these characters in
URLs.  At least one person I talked to earlier
today said they would expect the apostrophe to
be part of the URL (i.e. not a word boundary).
It may be even more tricky or more subjective
for parens.

Thoughts?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Fri, 22 Nov 2019 12:26:01 GMT) Full text and rfc822 format available.

Message #25 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Amin Bandali <bandali <at> gnu.org>
Cc: 38257 <at> debbugs.gnu.org
Subject: Re: bug#38257: Acknowledgement (27.0.50; ERC does not match or
 highlight nick surrounded by parens)
Date: Fri, 22 Nov 2019 13:25:02 +0100
Amin Bandali <bandali <at> gnu.org> writes:

> That said, from a brief chat with Tom Tromey in
> #erc on freenode today, I agree with him that
> one probably shouldn't make changes to syntax
> tables lightly, without first considering all
> possible cases.  I wonder if you or Tom would
> be so kind to do such an audit for this change.
> I'd also be open to other ways of doing this if
> there's a better way.  I guess in general it is
> kind of tricky to deal with these characters in
> URLs.  At least one person I talked to earlier
> today said they would expect the apostrophe to
> be part of the URL (i.e. not a word boundary).
> It may be even more tricky or more subjective
> for parens.
>
> Thoughts?

In general, you can't use syntax tables to give satisfactory URL DWIM
recognition.  Both of these things are common:

  There's a web page (http://foo.bar)

and

  There's a web page http://foo.bar/lala_(yes)

The latter is very common with Wikipedia URLs.

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.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Fri, 22 Nov 2019 12:33:01 GMT) Full text and rfc822 format available.

Message #28 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Amin Bandali <bandali <at> gnu.org>
Cc: 38257 <at> debbugs.gnu.org
Subject: Re: bug#38257: Acknowledgement (27.0.50; ERC does not match or
 highlight nick surrounded by parens)
Date: Fri, 22 Nov 2019 13:31:57 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> 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.

(Note that I'm not familiar with how erc does URL recognition, so what I
wrote may be totally irrelevant.  :-))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Fri, 22 Nov 2019 13:44:02 GMT) Full text and rfc822 format available.

Message #31 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Amin Bandali <bandali <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 38257 <at> debbugs.gnu.org
Subject: Re: bug#38257: Acknowledgement (27.0.50; ERC does not match or
 highlight nick surrounded by parens)
Date: Fri, 22 Nov 2019 08:42:59 -0500
Lars Ingebrigtsen <larsi <at> gnus.org> 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. :)

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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Tue, 26 Nov 2019 01:17:01 GMT) Full text and rfc822 format available.

Message #34 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 38366 <at> debbugs.gnu.org
Cc: 38257 <at> debbugs.gnu.org
Subject: Re: bug#38366: 25.1; ERC does not font lock genitive nickname's
Date: Tue, 26 Nov 2019 02:16:14 +0100
Emanuel Berg <moasenwood <at> zoho.eu> writes:

> ERC does not font lock genitive nickname's.
> So if someone writes, "I think ben's suggestion
> will work", ben doesn't get font locked with
> `erc-nick-default-face'.

I think this is fixed by the patch bug#38257 (which needs a bit more
work before being applied).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Forcibly Merged 38257 38366. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 26 Nov 2019 01:18:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Sun, 29 Dec 2019 04:31:02 GMT) Full text and rfc822 format available.

Message #39 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Amin Bandali <bandali <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 38257 <at> debbugs.gnu.org, Emanuel Berg <moasenwood <at> zoho.eu>
Subject: Re: 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 part 1 (text/plain, inline)]
Amin Bandali <bandali <at> gnu.org> writes:

> Lars Ingebrigtsen <larsi <at> gnus.org> 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’s suggestion.  Turns out there’s a C-h v erc-button-url-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’t 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’s 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):

- https://example.org/test"x
- https://example.org/test'x
- https://example.org/test’x
- https://example.org/test"
- https://example.org/test'
- https://example.org/test’

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’ve been using my patch every day for the past ~40 days,
and I haven’t had any issues with it so far.

                                 * * *

Finally, the updated patch (against master, but I’m hoping since it
hasn’t diverged from emacs-27 much yet, it should still apply there):

[0001-Improve-ERC-s-matching-of-nicks-and-URLs-bug-38257.patch (text/x-diff, inline)]
From 940d5e41ad5449bf0b0214b941de54ebbd5df546 Mon Sep 17 00:00:00 2001
From: Amin Bandali <bandali <at> gnu.org>
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=UTF-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’re 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.
---
 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
--- 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)
 
 ;;; Minor Mode
 
@@ -87,12 +88,9 @@ erc-button-mouse-face
   :type 'face
   :group 'erc-faces)
 
-(defcustom erc-button-url-regexp
-  (concat "\\(www\\.\\|\\(s?https?\\|"
-          "ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\)"
-          "\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?"
-          "[-a-zA-Z0-9_=!?#$@~`%&*+\\/:;.,()]+[-a-zA-Z0-9_=#$@~`%&*+\\/()]")
+(defcustom erc-button-url-regexp browse-url-button-regexp
   "Regular expression that matches URLs."
+  :version "27.1"
   :group 'erc-button
   :type 'regexp)
 
@@ -223,14 +221,11 @@ erc-button-keymap
 
 (defvar erc-button-syntax-table
   (let ((table (make-syntax-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)
     (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)
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index e9ed735516..336040a374 100644
--- 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)))
-    (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)
     (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)
-- 
2.23.0

[Message part 3 (text/plain, inline)]
-- 
Amin Bandali
Free Software Activist | GNU Maintainer & Webmaster
GPG: BE62 7373 8E61 6D6D 1B3A  08E8 A21A 0202 4881 6103
https://bandali.eu.org
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Sun, 29 Dec 2019 17:31:02 GMT) Full text and rfc822 format available.

Message #42 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Emanuel Berg <moasenwood <at> zoho.eu>
To: Amin Bandali <bandali <at> gnu.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 38257 <at> debbugs.gnu.org
Subject: Re: bug#38257: Acknowledgement (27.0.50;
 ERC does not match or highlight nick surrounded by parens)
Date: Sun, 29 Dec 2019 18:30:02 +0100
Amin Bandali wrote:

> So I had a bit of time on my hands again, and
> looked into erc-button per
> Lars’s suggestion. [...]

Good to hear that you work on ERC, I use it
every day and I hope many other do as well.
I'm preparing for my Hong Kong thing, but after
that God willing the first thing I'll do is
start ERC and type "Amin's solution is more
than good for government work", and I'll see
his name's genitive in a pleasant color :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Fri, 03 Jan 2020 23:43:01 GMT) Full text and rfc822 format available.

Message #45 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Corwin Brust <corwin <at> bru.st>
To: 38257 <at> debbugs.gnu.org
Subject: Still working well for me (GNU 26.3 Windows 10)
Date: Fri, 3 Jan 2020 17:39:37 -0600
[Message part 1 (text/plain, inline)]
I've been running with the patch since Nov with no issues.  As I said
before, missing message notifs bites.  I hope this can be applied soon!

-- 
*Corwin*
612-217-1742
612-298-0615 (fax)
612-695-4276 (mobile)
*corwin.brust (skype)corwin <at> bru.st <corwin <at> bru.st>*
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Sat, 04 Jan 2020 09:23:01 GMT) Full text and rfc822 format available.

Message #48 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Amin Bandali <bandali <at> gnu.org>
Cc: larsi <at> gnus.org, 38257 <at> debbugs.gnu.org, moasenwood <at> zoho.eu
Subject: Re: bug#38257: Acknowledgement (27.0.50;
 ERC does not match or highlight nick surrounded by parens)
Date: Sat, 04 Jan 2020 11:22:46 +0200
> From: Amin Bandali <bandali <at> gnu.org>
> Date: Sat, 28 Dec 2019 23:30:19 -0500
> Cc: 38257 <at> debbugs.gnu.org, Emanuel Berg <moasenwood <at> zoho.eu>
> 
> Finally, the updated patch (against master, but I’m hoping since it
> hasn’t diverged from emacs-27 much yet, it should still apply there):

It's fine with me to push this to the emacs-27 branch.  But I think
perhaps the backward-incompatible change in the syntax table should be
mentioned in NEWS, even though this is according to the RFCs?

Lars, do you have any comments?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Thu, 09 Jan 2020 07:15:02 GMT) Full text and rfc822 format available.

Message #51 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Amin Bandali <bandali <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: larsi <at> gnus.org, 38257 <at> debbugs.gnu.org, moasenwood <at> zoho.eu
Subject: Re: bug#38257: Acknowledgement (27.0.50; ERC does not match or
 highlight nick surrounded by parens)
Date: Thu, 09 Jan 2020 02:14:14 -0500
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Amin Bandali <bandali <at> gnu.org>
>> Date: Sat, 28 Dec 2019 23:30:19 -0500
>> Cc: 38257 <at> debbugs.gnu.org, Emanuel Berg <moasenwood <at> zoho.eu>
>> 
>> Finally, the updated patch (against master, but I’m hoping since it
>> hasn’t diverged from emacs-27 much yet, it should still apply there):
>
> It's fine with me to push this to the emacs-27 branch.  But I think
> perhaps the backward-incompatible change in the syntax table should be
> mentioned in NEWS, even though this is according to the RFCs?
>
> Lars, do you have any comments?
>
> Thanks.
>

Thank you for the feedback, Eli.  I’ve attached below an updated patch
with two NEWS entries and minor typo/format fixes in the commit message.
If there are no objections I’ll push this to emacs-27 after a few days.

[0001-Improve-ERC-s-matching-of-nicks-and-URLs-bug-38257.patch (text/x-diff, inline)]
From 19e6cd8b04ecdb34c6f7e227332a90ede4cc84d6 Mon Sep 17 00:00:00 2001
From: Amin Bandali <bandali <at> gnu.org>
Date: Mon, 18 Nov 2019 10:24:48 -0500
Subject: [PATCH v3] Improve ERC's matching of nicks and URLs (bug#38257)

* 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're surrounded by parens, like (nick), and when adjacent to
an apostrophe, 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.
---
 etc/NEWS               | 12 ++++++++++++
 lisp/erc/erc-button.el | 11 +++--------
 lisp/erc/erc-match.el  |  3 ---
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 6d4a6119af..02d9135571 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1569,6 +1569,18 @@ and its value has been changed to Duck Duck Go.
 The user option to use instead to alter text to be sent is now
 'erc-pre-send-functions'.
 
+---
+*** Improve matching/highlighting of nicknames
+Open and close parenthesis and apostrophe are not considered valid
+nick characters anymore, matching the given grammar in RFC 2812
+section 2.3.1.  This enables correct matching and highlighting of
+nicks when they are surrounded by parentheses, like (nick), and when
+adjacent to an apostrophe, like nick's.
+
+---
+*** Set 'erc-button-url-regexp' to 'browse-url-button-regexp'
+which better handles surrounding pair of parentheses.
+
 ** EUDC
 
 ---
diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index 6e30b3a793..e4f5a19091 100644
--- 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)
 
 ;;; Minor Mode
 
@@ -87,12 +88,9 @@ erc-button-mouse-face
   :type 'face
   :group 'erc-faces)
 
-(defcustom erc-button-url-regexp
-  (concat "\\(www\\.\\|\\(s?https?\\|"
-          "ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\)"
-          "\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?"
-          "[-a-zA-Z0-9_=!?#$@~`%&*+\\/:;.,()]+[-a-zA-Z0-9_=#$@~`%&*+\\/()]")
+(defcustom erc-button-url-regexp browse-url-button-regexp
   "Regular expression that matches URLs."
+  :version "27.1"
   :group 'erc-button
   :type 'regexp)
 
@@ -223,14 +221,11 @@ erc-button-keymap
 
 (defvar erc-button-syntax-table
   (let ((table (make-syntax-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)
     (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)
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index 7a824cce9f..8b9ab33128 100644
--- 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)))
-    (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)
     (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)
-- 
2.23.0

[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Thu, 09 Jan 2020 07:44:01 GMT) Full text and rfc822 format available.

Message #54 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Emanuel Berg <moasenwood <at> zoho.eu>
To: Amin Bandali <bandali <at> gnu.org>
Cc: 38257 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, larsi <at> gnus.org
Subject: Re: bug#38257: Acknowledgement (27.0.50;
 ERC does not match or highlight nick surrounded by parens)
Date: Thu, 09 Jan 2020 08:42:49 +0100
Amin Bandali wrote:

> * 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're surrounded by parens, like (nick),
> and when adjacent to an apostrophe,
> 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.
> ---
>  etc/NEWS               | 12 ++++++++++++
>  lisp/erc/erc-button.el | 11 +++--------
>  lisp/erc/erc-match.el  |  3 ---
>  3 files changed, 15 insertions(+), 11 deletions(-)

It is just amazing how this has been handled,
to care so much for the IRC client and also to
be able to strengthen the reasons for the
policy by finding one RFC!

> -(defcustom erc-button-url-regexp
> -  (concat "\\(www\\.\\|\\(s?https?\\|"
> -       "ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\)"
> -       "\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?"
> -       "[-a-zA-Z0-9_=!?#$@~`%&*+\\/:;.,()]+[-a-zA-Z0-9_=#$@~`%&*+\\/()]")
> +(defcustom erc-button-url-regexp browse-url-button-regexp
>    "Regular expression that matches URLs."
> +  :version "27.1"
>    :group 'erc-button
>    :type 'regexp)

Here I wonder why does the erc-button has this?
Don't Gnus, Emacs-w3m, man mode, virtually every
mode that is about communicating have
a tendency to come across hyperlinks?

--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Thu, 09 Jan 2020 18:42:02 GMT) Full text and rfc822 format available.

Message #57 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Amin Bandali <bandali <at> gnu.org>
To: Emanuel Berg <moasenwood <at> zoho.eu>
Cc: 38257 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, larsi <at> gnus.org
Subject: Re: bug#38257: Acknowledgement (27.0.50; ERC does not match or
 highlight nick surrounded by parens)
Date: Thu, 09 Jan 2020 13:41:46 -0500
[Message part 1 (text/plain, inline)]
Emanuel Berg <moasenwood <at> zoho.eu> writes:

[...]
>
> It is just amazing how this has been handled,
> to care so much for the IRC client and also to
> be able to strengthen the reasons for the
> policy by finding one RFC!
>

:-) Thanks, Emanuel.

>
[...]
> Here I wonder why does the erc-button has this?
> Don't Gnus, Emacs-w3m, man mode, virtually every
> mode that is about communicating have
> a tendency to come across hyperlinks?
>

Historical reasons, I’d imagine?

Doing a git-blame, it seems that ‘browse-url-button-regexp’ was
introduced in a32e1feb438e793a8378671c7124d226b58f65f0 [0], where Lars
refactored ‘gnus-button-url-regexp’ out from “lisp/gnus/gnus-art.el”
over to ‘browse-url-button-regexp’ in “lisp/net/browse-url.el”,
presumably for the very reason of other packages being able to use it
for controlling what’s considered a button.

[0]: https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=a32e1feb438e793a8378671c7124d226b58f65f0
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Sat, 11 Jan 2020 08:42:02 GMT) Full text and rfc822 format available.

Message #60 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Amin Bandali <bandali <at> gnu.org>
Cc: larsi <at> gnus.org, 38257 <at> debbugs.gnu.org, moasenwood <at> zoho.eu
Subject: Re: bug#38257: Acknowledgement (27.0.50; ERC does not match or
 highlight nick surrounded by parens)
Date: Sat, 11 Jan 2020 10:41:24 +0200
> From: Amin Bandali <bandali <at> gnu.org>
> Cc: larsi <at> gnus.org,  38257 <at> debbugs.gnu.org,  moasenwood <at> zoho.eu
> Date: Thu, 09 Jan 2020 02:14:14 -0500
> 
> Thank you for the feedback, Eli.  I’ve attached below an updated patch
> with two NEWS entries and minor typo/format fixes in the commit message.
> If there are no objections I’ll push this to emacs-27 after a few days.

Thanks, this is OK, with the following not fixed:

> +*** Improve matching/highlighting of nicknames

This should end with a period, as a complete sentence.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Mon, 13 Jan 2020 07:21:01 GMT) Full text and rfc822 format available.

Message #63 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Amin Bandali <bandali <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: larsi <at> gnus.org, 38257 <at> debbugs.gnu.org, moasenwood <at> zoho.eu
Subject: Re: bug#38257: Acknowledgement (27.0.50; ERC does not match or
 highlight nick surrounded by parens)
Date: Mon, 13 Jan 2020 02:19:59 -0500
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Amin Bandali <bandali <at> gnu.org>
>> Cc: larsi <at> gnus.org,  38257 <at> debbugs.gnu.org,  moasenwood <at> zoho.eu
>> Date: Thu, 09 Jan 2020 02:14:14 -0500
>> 
>> Thank you for the feedback, Eli.  I’ve attached below an updated patch
>> with two NEWS entries and minor typo/format fixes in the commit message.
>> If there are no objections I’ll push this to emacs-27 after a few days.
>
> Thanks, this is OK, with the following not fixed:
>
>> +*** Improve matching/highlighting of nicknames
>
> This should end with a period, as a complete sentence.
>

Thank you, Eli!  Fixed that, and pushed to emacs-27 as
37e0d00c143ddb6d5e978eb1d3ac9c1d1aba3860 [0].

[0]: https://git.sv.gnu.org/cgit/emacs.git/commit/?id=37e0d00c143ddb6d5e978eb1d3ac9c1d1aba3860
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Mon, 20 Jan 2020 18:56:01 GMT) Full text and rfc822 format available.

Message #66 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Amin Bandali <bandali <at> gnu.org>
Cc: 38257 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, larsi <at> gnus.org,
 moasenwood <at> zoho.eu
Subject: Re: bug#38257: Acknowledgement (27.0.50; ERC does not match or
 highlight nick surrounded by parens)
Date: Mon, 20 Jan 2020 19:55:44 +0100
Amin Bandali <bandali <at> gnu.org> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> From: Amin Bandali <bandali <at> gnu.org>
>>> Cc: larsi <at> gnus.org,  38257 <at> debbugs.gnu.org,  moasenwood <at> zoho.eu
>>> Date: Thu, 09 Jan 2020 02:14:14 -0500
>>> 
>>> Thank you for the feedback, Eli.  I’ve attached below an updated patch
>>> with two NEWS entries and minor typo/format fixes in the commit message.
>>> If there are no objections I’ll push this to emacs-27 after a few days.
>>
>> Thanks, this is OK, with the following not fixed:
>>
>>> +*** Improve matching/highlighting of nicknames
>>
>> This should end with a period, as a complete sentence.
>>
>
> Thank you, Eli!  Fixed that, and pushed to emacs-27 as
> 37e0d00c143ddb6d5e978eb1d3ac9c1d1aba3860 [0].

Should the bug also be closed, or is there anything more to do?

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38257; Package emacs. (Tue, 21 Jan 2020 13:37:01 GMT) Full text and rfc822 format available.

Message #69 received at 38257 <at> debbugs.gnu.org (full text, mbox):

From: Amin Bandali <bandali <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: larsi <at> gnus.org, control <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 38257 <at> debbugs.gnu.org, moasenwood <at> zoho.eu
Subject: Re: bug#38257: Acknowledgement (27.0.50; ERC does not match or
 highlight nick surrounded by parens)
Date: Tue, 21 Jan 2020 08:35:39 -0500
[Message part 1 (text/plain, inline)]
close 38257 27.1
quit

Hi Stefan,

Stefan Kangas <stefan <at> marxist.se> writes:

[...]
>
> Should the bug also be closed, or is there anything more to do?
>

Thanks, oversight on my end; this is good to close (should be done now).

>
> Best regards,
> Stefan Kangas
>

Best,
amin

-- 
Amin Bandali
Free Software activist | GNU maintainer & webmaster
GPG: BE62 7373 8E61 6D6D 1B3A  08E8 A21A 0202 4881 6103
https://bandali.eu.org
[signature.asc (application/pgp-signature, inline)]

bug marked as fixed in version 27.1, send any further explanations to 38257 <at> debbugs.gnu.org and Amin Bandali <bandali <at> gnu.org> Request was from Amin Bandali <bandali <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 21 Jan 2020 13:37:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 19 Feb 2020 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 60 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.