[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Make rcirc.el rcirc-url-regexp use the gnus-button-url-regexp re
From: |
Ævar Arnfjörð Bjarmason |
Subject: |
[PATCH] Make rcirc.el rcirc-url-regexp use the gnus-button-url-regexp regexp |
Date: |
Sun, 23 Dec 2007 03:03:09 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) |
I was having an issue with rcirc including at the end of URIs. I fixed
it by using the regex gnus uses.
Perhaps it's better to amend the old one.
Index: net/rcirc.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/rcirc.el,v
retrieving revision 1.40
diff -u -r1.40 rcirc.el
--- net/rcirc.el 1 Nov 2007 03:51:47 -0000 1.40
+++ net/rcirc.el 23 Dec 2007 02:36:07 -0000
@@ -2121,24 +2121,26 @@
(rcirc-add-face 0 (length string) face string)
string))
+;; The regexp is copied from gnus-button-url-regexp in gnus-art.el
(defvar rcirc-url-regexp
- (rx-to-string
- `(and word-boundary
- (or (and
- (or (and (or "http" "https" "ftp" "file" "gopher" "news"
- "telnet" "wais" "mailto")
- "://")
- "www.")
- (1+ (char "-a-zA-Z0-9_."))
- (1+ (char "-a-zA-Z0-9_"))
- (optional ":" (1+ (char "0-9"))))
- (and (1+ (char "-a-zA-Z0-9_."))
- (or ".com" ".net" ".org")
- word-boundary))
- (optional
- (and "/"
- (1+ (char "-a-zA-Z0-9_='address@hidden&*+|\\/:;.,{}[]()"))
- (char "address@hidden&*+|\\/:;{}[]()")))))
+ (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 "address@hidden&*+\\/[:word:]")
+ (punct "!?:;.,"))
+ (concat
+ "\\(?:"
+ ;; Match paired parentheses, e.g. in Wikipedia URLs:
+ "[" chars punct "]+" "(" "[" chars punct "]+" "[" chars "]*)" "["
chars "]"
+ "\\|"
+ "[" chars punct "]+" "[" chars "]"
+ "\\)"))
+ (concat ;; XEmacs 21.4 doesn't support POSIX.
+ "\\(address@hidden&*+\\/:;.,]\\|\\w\\)+"
+ "\\(address@hidden&*+\\/]\\|\\w\\)"))
+ "\\)")
"Regexp matching URLs. Set to nil to disable URL features in rcirc.")
(defun rcirc-browse-url (&optional arg)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Make rcirc.el rcirc-url-regexp use the gnus-button-url-regexp regexp,
Ævar Arnfjörð Bjarmason <=