]> git.eshelyaron.com Git - emacs.git/commitdiff
Use browse-url-button-regexp for rcirc-url-regexp
authorPhilip Kaludercic <philipk@posteo.net>
Wed, 13 Oct 2021 19:49:28 +0000 (21:49 +0200)
committerPhilip Kaludercic <philipk@posteo.net>
Wed, 13 Oct 2021 19:49:28 +0000 (21:49 +0200)
* rcirc.el (rcirc-url-regexp): Copy improved regexp from browse-url

lisp/net/rcirc.el

index c18748ae0999b7ca812c04b41ea12da19da5e409..52d74a33945c4f96cad45123d39315162b01d722 100644 (file)
@@ -2827,24 +2827,9 @@ keywords when no KEYWORD is given."
     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\\)"))
-   "\\)")
+  (eval-when-compile
+    (require 'browse-url)
+    browse-url-button-regexp)
   "Regexp matching URLs.  Set to nil to disable URL features in rcirc.")
 
 ;; cf cl-remove-if-not