changeset 16669:0bd213d55f05

(browse-url-url-at-point): Use thing-at-point. (browse-url-looking-at): Function deleted.
author Richard M. Stallman <rms@gnu.org>
date Wed, 11 Dec 1996 21:06:18 +0000
parents bf249c4b4beb
children 37fa6003964d
files lisp/browse-url.el
diffstat 1 files changed, 6 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/browse-url.el	Wed Dec 11 20:59:18 1996 +0000
+++ b/lisp/browse-url.el	Wed Dec 11 21:06:18 1996 +0000
@@ -368,32 +368,12 @@
 (defun browse-url-url-at-point ()
   "Return the URL around or before point.
 Search backwards for the start of a URL ending at or after 
-point.  If no URL found, return the empty string.  The
-access scheme, `http://' will be prepended if absent."
-  (cond ((browse-url-looking-at browse-url-regexp)
-	 (buffer-substring (match-beginning 0) (match-end 0)))
-	;; Access scheme omitted?
-	((browse-url-looking-at browse-url-short-regexp)
-	 (concat "http://"
-		 (buffer-substring (match-beginning 0) (match-end 0))))
-	(t "")))			; No match
-
-(defun browse-url-looking-at (regexp)
-  "Return non-nil if point is in or just after a match for REGEXP.
-Set the match data from the earliest such match in the current line
-ending at or after point."
-  (save-excursion
-    (let ((old-point (point))
-	  (eol (progn (end-of-line) (point)))
-	  (hit nil))
-      (beginning-of-line)
-      (or (and (looking-at regexp)
-	       (>= (match-end 0) old-point))
-	  (progn
-	    (while (and (re-search-forward regexp eol t)
-			(<= (match-beginning 0) old-point)
-			(not (setq hit (>= (match-end 0) old-point)))))
-	    hit)))))
+point.  If no URL found, return the empty string.
+A file name is also acceptable, and `http://' will be prepended to it."
+  (or (thing-at-point 'url)
+      (let ((file (thing-at-point 'file)))
+	(if file (concat "http://" file)))
+      ""))
 
 ;; Having this as a separate function called by the browser-specific
 ;; functions allows them to be stand-alone commands, making it easier