From 47e95361abb5ab7445feedf4a701ffaabde2dc44 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 4 Jun 2021 14:04:34 +0200 Subject: [PATCH 03/11] Define rcirc-url-regexp using browse-url-button-regexp --- lisp/net/rcirc.el | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 67dcf3e4ea..00d48ba0e2 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -45,6 +45,7 @@ (require 'ring) (require 'time-date) (require 'auth-source) +(require 'browse-url) (eval-when-compile (require 'subr-x)) (defconst rcirc-id-string (concat "rcirc on GNU Emacs " emacs-version)) @@ -2414,25 +2415,7 @@ rcirc-facify (rcirc-add-face 0 (length string) face string) string)) -(defvar rcirc-url-regexp - (concat - "\\b\\(\\(www\\.\\|\\(s?https?\\|ftp\\|file\\|gopher\\|" - "nntp\\|news\\|telnet\\|wais\\|mailto\\|info\\):\\)" - "\\(//[-a-z0-9_.]+:[0-9]*\\)?" - (if (string-match "[[:digit:]]" "1") ;; Support POSIX? - (let ((chars "-a-z0-9_=#$@~%&*+\\/[:word:]") - (punct "!?:;.,")) - (concat - "\\(?:" - ;; Match paired parentheses, e.g. in Wikipedia URLs: - "[" chars punct "]+" "(" "[" chars punct "]+" ")" "[" chars "]" - "\\|" - "[" chars punct "]+" "[" chars "]" - "\\)")) - (concat ;; XEmacs 21.4 doesn't support POSIX. - "\\([-a-z0-9_=!?#$@~%&*+\\/:;.,]\\|\\w\\)+" - "\\([-a-z0-9_=#$@~%&*+\\/]\\|\\w\\)")) - "\\)") +(defvar rcirc-url-regexp browse-url-button-regexp "Regexp matching URLs. Set to nil to disable URL features in rcirc.") ;; cf cl-remove-if-not -- 2.30.2