:group 'hypermedia)
-;;; I don't expect users to want fontify'ing without highlighting.
+;; I don't expect users to want fontify'ing without highlighting.
(defcustom goto-address-fontify-p t
"*Non-nil means URLs and e-mail addresses in buffer are fontified.
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
-;;; (concat "\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|"
-;;; "telnet\\|wais\\):\\(//[-a-zA-Z0-9_.]+:"
-;;; "[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*"
-;;; "[-a-zA-Z0-9_=#$@~`%&*+|\\/]")
+(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_=?#$@~`%&*+|\\/.,]*"
+ ;; "[-a-zA-Z0-9_=#$@~`%&*+|\\/]")
"A regular expression probably matching a URL.")
(defvar goto-address-highlight-keymap
(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))
(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)))
(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))))))))
-;;; code to find and goto addresses; much of this has been blatantly
-;;; snarfed from browse-url.el
+;; code to find and goto addresses; much of this has been blatantly
+;; snarfed from browse-url.el
;;;###autoload
(defun goto-address-at-mouse (event)
(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
(provide 'goto-addr)
-;;; goto-addr.el ends here.
+;;; arch-tag: ca47c505-5661-425d-a471-62bc6e75cf0a
+;;; goto-addr.el ends here