]> code.delx.au - gnu-emacs/blobdiff - lisp/net/goto-addr.el
Add a provide statement.
[gnu-emacs] / lisp / net / goto-addr.el
index 61c615b4aca4b63e569e297927385d00d31706b5..428da8cbe8a05fa06fe3fc54c953d76e03a17b1d 100644 (file)
@@ -93,15 +93,23 @@ But only if `goto-address-highlight-p' is also non-nil."
   :group 'goto-address)
 
 (defcustom goto-address-fontify-maximum-size 30000
-  "*Maximum size of file in which to fontify and/or highlight URLs."
-  :type 'integer
+  "*Maximum size of file in which to fontify and/or highlight URLs.
+A value of t means there is no limit--fontify regardless of the size."
+  :type '(choice (integer :tag "Maximum size") (const :tag "No limit" t))
   :group 'goto-address)
 
 (defvar goto-address-mail-regexp
-  "[-a-zA-Z0-9._]+@\\([-a-zA-z0-9_]+\\.\\)+[a-zA-Z0-9]+"
+  ;; Actually pretty much any char could appear in the username part.  -stef
+  "[-a-zA-Z0-9._+]+@\\([-a-zA-z0-9_]+\\.\\)+[a-zA-Z0-9]+"
   "A regular expression probably matching an e-mail address.")
 
-(defvar goto-address-url-regexp thing-at-point-url-regexp
+(defvar goto-address-url-regexp
+  (concat "\\<\\("
+         (mapconcat 'identity
+                    (delete "mailto:" (copy-sequence thing-at-point-uri-schemes))
+                    "\\|")
+         "\\)"
+          thing-at-point-url-path-regexp)
   ;; (concat "\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|"
   ;;     "telnet\\|wais\\):\\(//[-a-zA-Z0-9_.]+:"
   ;;     "[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*"
@@ -148,7 +156,8 @@ and `goto-address-fontify-p'."
   (save-excursion
     (let ((inhibit-point-motion-hooks t))
       (goto-char (point-min))
-      (if (< (- (point-max) (point)) goto-address-fontify-maximum-size)
+      (if (or (eq t goto-address-fontify-maximum-size)
+             (< (- (point-max) (point)) goto-address-fontify-maximum-size))
          (progn
            (while (re-search-forward goto-address-url-regexp nil t)
               (let* ((s (match-beginning 0))
@@ -159,7 +168,7 @@ and `goto-address-fontify-p'."
                (overlay-put this-overlay
                              'mouse-face goto-address-url-mouse-face)
                (overlay-put this-overlay
-                            'help-echo "mouse-2: follow URL")
+                            'help-echo "mouse-2, C-c RET: follow URL")
                (overlay-put this-overlay
                              'keymap goto-address-highlight-keymap)
                (overlay-put this-overlay 'goto-address t)))
@@ -173,7 +182,7 @@ and `goto-address-fontify-p'."
                 (overlay-put this-overlay 'mouse-face
                              goto-address-mail-mouse-face)
                (overlay-put this-overlay
-                            'help-echo "mouse-2: mail this address")
+                            'help-echo "mouse-2, C-c RET: mail this address")
                 (overlay-put this-overlay
                              'keymap goto-address-highlight-keymap)
                (overlay-put this-overlay 'goto-address t))))))))
@@ -201,7 +210,7 @@ there, then load the URL at or before point."
   (interactive)
   (save-excursion
     (let ((address (save-excursion (goto-address-find-address-at-point))))
-      (if (and address 
+      (if (and address
               (save-excursion
                 (goto-char (previous-single-char-property-change
                             (point) 'goto-address nil
@@ -239,4 +248,5 @@ Also fontifies the buffer appropriately (see `goto-address-fontify-p' and
 
 (provide 'goto-addr)
 
+;;; arch-tag: ca47c505-5661-425d-a471-62bc6e75cf0a
 ;;; goto-addr.el ends here