aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-12-11 21:06:18 +0000
committerRichard M. Stallman1996-12-11 21:06:18 +0000
commit0f995be681f4db236429ea3cf5f62914ebe6f86b (patch)
tree1b0392b7b1050c832b1c8e27921c6594d8073b75
parent02807c95d318a13b7bc56ab320916686437aeb83 (diff)
downloademacs-0f995be681f4db236429ea3cf5f62914ebe6f86b.tar.gz
emacs-0f995be681f4db236429ea3cf5f62914ebe6f86b.zip
(browse-url-url-at-point): Use thing-at-point.
(browse-url-looking-at): Function deleted.
-rw-r--r--lisp/browse-url.el32
1 files changed, 6 insertions, 26 deletions
diff --git a/lisp/browse-url.el b/lisp/browse-url.el
index ca4cad0e888..1af08b0606b 100644
--- a/lisp/browse-url.el
+++ b/lisp/browse-url.el
@@ -368,32 +368,12 @@ enabled. The port number should be set in `browse-url-CCI-port'.")
368(defun browse-url-url-at-point () 368(defun browse-url-url-at-point ()
369 "Return the URL around or before point. 369 "Return the URL around or before point.
370Search backwards for the start of a URL ending at or after 370Search backwards for the start of a URL ending at or after
371point. If no URL found, return the empty string. The 371point. If no URL found, return the empty string.
372access scheme, `http://' will be prepended if absent." 372A file name is also acceptable, and `http://' will be prepended to it."
373 (cond ((browse-url-looking-at browse-url-regexp) 373 (or (thing-at-point 'url)
374 (buffer-substring (match-beginning 0) (match-end 0))) 374 (let ((file (thing-at-point 'file)))
375 ;; Access scheme omitted? 375 (if file (concat "http://" file)))
376 ((browse-url-looking-at browse-url-short-regexp) 376 ""))
377 (concat "http://"
378 (buffer-substring (match-beginning 0) (match-end 0))))
379 (t ""))) ; No match
380
381(defun browse-url-looking-at (regexp)
382 "Return non-nil if point is in or just after a match for REGEXP.
383Set the match data from the earliest such match in the current line
384ending at or after point."
385 (save-excursion
386 (let ((old-point (point))
387 (eol (progn (end-of-line) (point)))
388 (hit nil))
389 (beginning-of-line)
390 (or (and (looking-at regexp)
391 (>= (match-end 0) old-point))
392 (progn
393 (while (and (re-search-forward regexp eol t)
394 (<= (match-beginning 0) old-point)
395 (not (setq hit (>= (match-end 0) old-point)))))
396 hit)))))
397 377
398;; Having this as a separate function called by the browser-specific 378;; Having this as a separate function called by the browser-specific
399;; functions allows them to be stand-alone commands, making it easier 379;; functions allows them to be stand-alone commands, making it easier