mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
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.
This commit is contained in:
parent
d47b157969
commit
37e0d00c14
3 changed files with 15 additions and 11 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue