From: Amin Bandali <bandali@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: larsi@gnus.org, 38257@debbugs.gnu.org, moasenwood@zoho.eu
Subject: 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 [thread overview]
Message-ID: <87zhex14qh.fsf@gnu.org> (raw)
In-Reply-To: <83eewfh8yh.fsf@gnu.org>
[-- 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 --]
next prev parent reply other threads:[~2020-01-09 7:14 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zhex14qh.fsf@gnu.org \
--to=bandali@gnu.org \
--cc=38257@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=larsi@gnus.org \
--cc=moasenwood@zoho.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.