comparison lisp/net/goto-addr.el @ 51098:9277afae9517

(goto-address-fontify-maximum-size): Value t means no limit. (goto-address-fontify): Implement that feature.
author Richard M. Stallman <rms@gnu.org>
date Mon, 19 May 2003 14:49:25 +0000
parents 0d8b17d428b5
children 695cf19ef79e
comparison
equal deleted inserted replaced
51097:37a69a2f1992 51098:9277afae9517
91 "*Non-nil means URLs and e-mail addresses in buffer are highlighted." 91 "*Non-nil means URLs and e-mail addresses in buffer are highlighted."
92 :type 'boolean 92 :type 'boolean
93 :group 'goto-address) 93 :group 'goto-address)
94 94
95 (defcustom goto-address-fontify-maximum-size 30000 95 (defcustom goto-address-fontify-maximum-size 30000
96 "*Maximum size of file in which to fontify and/or highlight URLs." 96 "*Maximum size of file in which to fontify and/or highlight URLs.
97 :type 'integer 97 A value of t means there is no limit--fontify regardless of the size."
98 :type '(choice (integer :tag "Maximum size") (const :tag "No limit" t))
98 :group 'goto-address) 99 :group 'goto-address)
99 100
100 (defvar goto-address-mail-regexp 101 (defvar goto-address-mail-regexp
101 ;; Actually pretty much any char could appear in the username part. -stef 102 ;; Actually pretty much any char could appear in the username part. -stef
102 "[-a-zA-Z0-9._+]+@\\([-a-zA-z0-9_]+\\.\\)+[a-zA-Z0-9]+" 103 "[-a-zA-Z0-9._+]+@\\([-a-zA-z0-9_]+\\.\\)+[a-zA-Z0-9]+"
153 (if (overlay-get overlay 'goto-address) 154 (if (overlay-get overlay 'goto-address)
154 (delete-overlay overlay))) 155 (delete-overlay overlay)))
155 (save-excursion 156 (save-excursion
156 (let ((inhibit-point-motion-hooks t)) 157 (let ((inhibit-point-motion-hooks t))
157 (goto-char (point-min)) 158 (goto-char (point-min))
158 (if (< (- (point-max) (point)) goto-address-fontify-maximum-size) 159 (if (or (eq t goto-address-fontify-maximum-size)
160 (< (- (point-max) (point)) goto-address-fontify-maximum-size))
159 (progn 161 (progn
160 (while (re-search-forward goto-address-url-regexp nil t) 162 (while (re-search-forward goto-address-url-regexp nil t)
161 (let* ((s (match-beginning 0)) 163 (let* ((s (match-beginning 0))
162 (e (match-end 0)) 164 (e (match-end 0))
163 (this-overlay (make-overlay s e))) 165 (this-overlay (make-overlay s e)))