* bug#38257: 27.0.50; ERC does not match or highlight nick surrounded by parens
@ 2019-11-18 15:40 Amin Bandali
[not found] ` <handler.38257.B.15740916515869.ack@debbugs.gnu.org>
` (2 more replies)
0 siblings, 3 replies; 20+ messages in thread
From: Amin Bandali @ 2019-11-18 15:40 UTC (permalink / raw)
To: 38257
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
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
[not found] ` <handler.38257.B.15740916515869.ack@debbugs.gnu.org>
@ 2019-11-18 15:49 ` Amin Bandali
2019-11-20 6:04 ` Amin Bandali
0 siblings, 1 reply; 20+ messages in thread
From: Amin Bandali @ 2019-11-18 15:49 UTC (permalink / raw)
To: 38257
[-- Attachment #1: Type: text/plain, Size: 49 bytes --]
Here’s a patch that fixes the issue for me:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-ERC-not-matching-nicks-surrounded-parens-bug-38257.patch --]
[-- Type: text/x-diff, Size: 1455 bytes --]
From 10f1fb7ccfb3e76dbd5df44f3f0e2780d24ba99b Mon Sep 17 00:00:00 2001
From: Amin Bandali <bandali@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
^ permalink raw reply related [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2019-11-18 15:49 ` bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens) Amin Bandali
@ 2019-11-20 6:04 ` Amin Bandali
2019-11-21 14:03 ` Lars Ingebrigtsen
0 siblings, 1 reply; 20+ messages in thread
From: Amin Bandali @ 2019-11-20 6:04 UTC (permalink / raw)
To: 38257
[-- Attachment #1: Type: text/plain, Size: 105 bytes --]
Here’s a v2 that fixes the issue for
apostrophes as well, with a slightly tweaked
commit message.
[-- Attachment #2: 0001-Improve-ERC-s-matching-of-nicks-bug-38257.patch --]
[-- Type: text/x-diff, Size: 2239 bytes --]
From 1185e528641cbce618db93aa6604899e79300522 Mon Sep 17 00:00:00 2001
From: Amin Bandali <bandali@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
^ permalink raw reply related [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2019-11-20 6:04 ` Amin Bandali
@ 2019-11-21 14:03 ` Lars Ingebrigtsen
2019-11-22 1:06 ` Amin Bandali
0 siblings, 1 reply; 20+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-21 14:03 UTC (permalink / raw)
To: Amin Bandali; +Cc: 38257
Amin Bandali <bandali@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
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Missed notif > broken buttons
2019-11-18 15:40 bug#38257: 27.0.50; ERC does not match or highlight nick surrounded by parens Amin Bandali
[not found] ` <handler.38257.B.15740916515869.ack@debbugs.gnu.org>
@ 2019-11-21 20:17 ` Corwin Brust
2020-01-03 23:39 ` bug#38257: Still working well for me (GNU 26.3 Windows 10) Corwin Brust
2 siblings, 0 replies; 20+ messages in thread
From: Corwin Brust @ 2019-11-21 20:17 UTC (permalink / raw)
To: 38257
[-- Attachment #1: Type: text/plain, Size: 298 bytes --]
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@bru.st <corwin@bru.st>*
[-- Attachment #2: Type: text/html, Size: 1059 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2019-11-21 14:03 ` Lars Ingebrigtsen
@ 2019-11-22 1:06 ` Amin Bandali
2019-11-22 12:25 ` Lars Ingebrigtsen
0 siblings, 1 reply; 20+ messages in thread
From: Amin Bandali @ 2019-11-22 1:06 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 38257
Lars Ingebrigtsen <larsi@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?
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2019-11-22 1:06 ` Amin Bandali
@ 2019-11-22 12:25 ` Lars Ingebrigtsen
2019-11-22 12:31 ` Lars Ingebrigtsen
2019-11-22 13:42 ` Amin Bandali
0 siblings, 2 replies; 20+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-22 12:25 UTC (permalink / raw)
To: Amin Bandali; +Cc: 38257
Amin Bandali <bandali@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
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2019-11-22 12:25 ` Lars Ingebrigtsen
@ 2019-11-22 12:31 ` Lars Ingebrigtsen
2019-11-22 13:42 ` Amin Bandali
1 sibling, 0 replies; 20+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-22 12:31 UTC (permalink / raw)
To: Amin Bandali; +Cc: 38257
Lars Ingebrigtsen <larsi@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
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2019-11-22 12:25 ` Lars Ingebrigtsen
2019-11-22 12:31 ` Lars Ingebrigtsen
@ 2019-11-22 13:42 ` Amin Bandali
2019-12-29 4:30 ` Amin Bandali
1 sibling, 1 reply; 20+ messages in thread
From: Amin Bandali @ 2019-11-22 13:42 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 38257
Lars Ingebrigtsen <larsi@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.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2019-11-22 13:42 ` Amin Bandali
@ 2019-12-29 4:30 ` Amin Bandali
2019-12-29 17:30 ` Emanuel Berg via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-01-04 9:22 ` Eli Zaretskii
0 siblings, 2 replies; 20+ messages in thread
From: Amin Bandali @ 2019-12-29 4:30 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 38257, Emanuel Berg
[-- Attachment #1.1: Type: text/plain, Size: 2180 bytes --]
Amin Bandali <bandali@gnu.org> writes:
> Lars Ingebrigtsen <larsi@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):
[-- Attachment #1.2: 0001-Improve-ERC-s-matching-of-nicks-and-URLs-bug-38257.patch --]
[-- Type: text/x-diff, Size: 3106 bytes --]
From 940d5e41ad5449bf0b0214b941de54ebbd5df546 Mon Sep 17 00:00:00 2001
From: Amin Bandali <bandali@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
[-- Attachment #1.3: Type: text/plain, Size: 155 bytes --]
--
Amin Bandali
Free Software Activist | GNU Maintainer & Webmaster
GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103
https://bandali.eu.org
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]
^ permalink raw reply related [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2019-12-29 4:30 ` Amin Bandali
@ 2019-12-29 17:30 ` Emanuel Berg via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-01-04 9:22 ` Eli Zaretskii
1 sibling, 0 replies; 20+ messages in thread
From: Emanuel Berg via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2019-12-29 17:30 UTC (permalink / raw)
To: Amin Bandali; +Cc: Lars Ingebrigtsen, 38257
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
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Still working well for me (GNU 26.3 Windows 10)
2019-11-18 15:40 bug#38257: 27.0.50; ERC does not match or highlight nick surrounded by parens Amin Bandali
[not found] ` <handler.38257.B.15740916515869.ack@debbugs.gnu.org>
2019-11-21 20:17 ` bug#38257: Missed notif > broken buttons Corwin Brust
@ 2020-01-03 23:39 ` Corwin Brust
2 siblings, 0 replies; 20+ messages in thread
From: Corwin Brust @ 2020-01-03 23:39 UTC (permalink / raw)
To: 38257
[-- Attachment #1: Type: text/plain, Size: 262 bytes --]
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@bru.st <corwin@bru.st>*
[-- Attachment #2: Type: text/html, Size: 1155 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2019-12-29 4:30 ` Amin Bandali
2019-12-29 17:30 ` Emanuel Berg via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-01-04 9:22 ` Eli Zaretskii
2020-01-09 7:14 ` Amin Bandali
1 sibling, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2020-01-04 9:22 UTC (permalink / raw)
To: Amin Bandali; +Cc: larsi, 38257, moasenwood
> From: Amin Bandali <bandali@gnu.org>
> Date: Sat, 28 Dec 2019 23:30:19 -0500
> Cc: 38257@debbugs.gnu.org, Emanuel Berg <moasenwood@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.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2020-01-04 9:22 ` Eli Zaretskii
@ 2020-01-09 7:14 ` Amin Bandali
2020-01-09 7:42 ` Emanuel Berg via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-01-11 8:41 ` Eli Zaretskii
0 siblings, 2 replies; 20+ messages in thread
From: Amin Bandali @ 2020-01-09 7:14 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: larsi, 38257, moasenwood
[-- Attachment #1.1: Type: text/plain, Size: 838 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Amin Bandali <bandali@gnu.org>
>> Date: Sat, 28 Dec 2019 23:30:19 -0500
>> Cc: 38257@debbugs.gnu.org, Emanuel Berg <moasenwood@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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Improve-ERC-s-matching-of-nicks-and-URLs-bug-38257.patch --]
[-- Type: text/x-diff, Size: 3848 bytes --]
From 19e6cd8b04ecdb34c6f7e227332a90ede4cc84d6 Mon Sep 17 00:00:00 2001
From: Amin Bandali <bandali@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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]
^ permalink raw reply related [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2020-01-09 7:14 ` Amin Bandali
@ 2020-01-09 7:42 ` Emanuel Berg via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-01-09 18:41 ` Amin Bandali
2020-01-11 8:41 ` Eli Zaretskii
1 sibling, 1 reply; 20+ messages in thread
From: Emanuel Berg via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-01-09 7:42 UTC (permalink / raw)
To: Amin Bandali; +Cc: 38257, Eli Zaretskii, larsi
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
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2020-01-09 7:42 ` Emanuel Berg via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-01-09 18:41 ` Amin Bandali
0 siblings, 0 replies; 20+ messages in thread
From: Amin Bandali @ 2020-01-09 18:41 UTC (permalink / raw)
To: Emanuel Berg; +Cc: larsi, 38257
[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]
Emanuel Berg <moasenwood@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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2020-01-09 7:14 ` Amin Bandali
2020-01-09 7:42 ` Emanuel Berg via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-01-11 8:41 ` Eli Zaretskii
2020-01-13 7:19 ` Amin Bandali
1 sibling, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2020-01-11 8:41 UTC (permalink / raw)
To: Amin Bandali; +Cc: larsi, 38257, moasenwood
> From: Amin Bandali <bandali@gnu.org>
> Cc: larsi@gnus.org, 38257@debbugs.gnu.org, moasenwood@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.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2020-01-11 8:41 ` Eli Zaretskii
@ 2020-01-13 7:19 ` Amin Bandali
2020-01-20 18:55 ` Stefan Kangas
0 siblings, 1 reply; 20+ messages in thread
From: Amin Bandali @ 2020-01-13 7:19 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: larsi, 38257, moasenwood
[-- Attachment #1: Type: text/plain, Size: 806 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Amin Bandali <bandali@gnu.org>
>> Cc: larsi@gnus.org, 38257@debbugs.gnu.org, moasenwood@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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2020-01-13 7:19 ` Amin Bandali
@ 2020-01-20 18:55 ` Stefan Kangas
2020-01-21 13:35 ` Amin Bandali
0 siblings, 1 reply; 20+ messages in thread
From: Stefan Kangas @ 2020-01-20 18:55 UTC (permalink / raw)
To: Amin Bandali; +Cc: larsi, 38257, moasenwood
Amin Bandali <bandali@gnu.org> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Amin Bandali <bandali@gnu.org>
>>> Cc: larsi@gnus.org, 38257@debbugs.gnu.org, moasenwood@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
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens)
2020-01-20 18:55 ` Stefan Kangas
@ 2020-01-21 13:35 ` Amin Bandali
0 siblings, 0 replies; 20+ messages in thread
From: Amin Bandali @ 2020-01-21 13:35 UTC (permalink / raw)
To: Stefan Kangas; +Cc: 38257, larsi, control, moasenwood
[-- Attachment #1: Type: text/plain, Size: 453 bytes --]
close 38257 27.1
quit
Hi Stefan,
Stefan Kangas <stefan@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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2020-01-21 13:35 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-18 15:40 bug#38257: 27.0.50; ERC does not match or highlight nick surrounded by parens Amin Bandali
[not found] ` <handler.38257.B.15740916515869.ack@debbugs.gnu.org>
2019-11-18 15:49 ` bug#38257: Acknowledgement (27.0.50; ERC does not match or highlight nick surrounded by parens) Amin Bandali
2019-11-20 6:04 ` Amin Bandali
2019-11-21 14:03 ` Lars Ingebrigtsen
2019-11-22 1:06 ` Amin Bandali
2019-11-22 12:25 ` Lars Ingebrigtsen
2019-11-22 12:31 ` Lars Ingebrigtsen
2019-11-22 13:42 ` Amin Bandali
2019-12-29 4:30 ` Amin Bandali
2019-12-29 17:30 ` Emanuel Berg via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-01-04 9:22 ` Eli Zaretskii
2020-01-09 7:14 ` Amin Bandali
2020-01-09 7:42 ` Emanuel Berg via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-01-09 18:41 ` Amin Bandali
2020-01-11 8:41 ` Eli Zaretskii
2020-01-13 7:19 ` Amin Bandali
2020-01-20 18:55 ` Stefan Kangas
2020-01-21 13:35 ` Amin Bandali
2019-11-21 20:17 ` bug#38257: Missed notif > broken buttons Corwin Brust
2020-01-03 23:39 ` bug#38257: Still working well for me (GNU 26.3 Windows 10) Corwin Brust
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.