]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve ERC's matching of nicks and URLs (bug#38257)
authorAmin Bandali <bandali@gnu.org>
Mon, 18 Nov 2019 15:24:48 +0000 (10:24 -0500)
committerAmin Bandali <bandali@gnu.org>
Mon, 13 Jan 2020 06:51:00 +0000 (01:51 -0500)
* 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
lisp/erc/erc-button.el
lisp/erc/erc-match.el

index 43805bb0ac63cc631b6d8b7d7086cae4d5690543..ac818a24907ddd1af0a41ac0dc9cabd06c8eb6f6 100644 (file)
--- 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
 
 ---
index 6e30b3a793501cd13c1f8ddcda7fb89a03719e48..e4f5a1909136bf2a2b72fdb42a184d015bb6c7f7 100644 (file)
@@ -41,6 +41,7 @@
 (require 'erc)
 (require 'wid-edit)
 (require 'erc-fill)
+(require 'browse-url)
 
 ;;; Minor Mode
 
@@ -87,12 +88,9 @@ above them."
   :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 @@ PAR is a number of a regexp grouping whose text will be passed to
 
 (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)
index 7a824cce9f8fdbd60d9474b2ff516ca9f2bcb2fa..8b9ab3312884a4e9540df9b85194f52b5bf6c3f7 100644 (file)
@@ -246,14 +246,11 @@ and other miscellaneous functions."
 ;; 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)