aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-01-05 15:41:44 +0000
committerDave Love2000-01-05 15:41:44 +0000
commitc7f836c751befc88c4c2c230ce1fc4128fcfc893 (patch)
tree0fe25db0cd23e40c173f7cd6e259cff4b10ef8fe
parenta2cc2b283ec249ff3bf570531249cd6dee1876ad (diff)
downloademacs-c7f836c751befc88c4c2c230ce1fc4128fcfc893.tar.gz
emacs-c7f836c751befc88c4c2c230ce1fc4128fcfc893.zip
(browse-url): Fix case of browse-url-browser-function being an alist.
-rw-r--r--lisp/browse-url.el34
1 files changed, 19 insertions, 15 deletions
diff --git a/lisp/browse-url.el b/lisp/browse-url.el
index a4e4fcae1d0..ba3c767796e 100644
--- a/lisp/browse-url.el
+++ b/lisp/browse-url.el
@@ -1,6 +1,6 @@
1;;; browse-url.el --- Pass a URL to a WWW browser 1;;; browse-url.el --- Pass a URL to a WWW browser
2 2
3;; Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. 3;; Copyright (C) 1995, 96-99, 2000 Free Software Foundation, Inc.
4 4
5;; Author: Denis Howe <dbh@doc.ic.ac.uk> 5;; Author: Denis Howe <dbh@doc.ic.ac.uk>
6;; Maintainer: Dave Love <fx@gnu.org> 6;; Maintainer: Dave Love <fx@gnu.org>
@@ -85,9 +85,8 @@
85;; Python see <url:http://www.python.org/>. Grail support in 85;; Python see <url:http://www.python.org/>. Grail support in
86;; browse-url.el written by Barry Warsaw <bwarsaw@python.org>. 86;; browse-url.el written by Barry Warsaw <bwarsaw@python.org>.
87 87
88;; MMM is the freely available WWW browser implemented in Objective 88;; MMM is a semi-free WWW browser implemented in Objective Caml, an
89;; Caml, a cool impure functional programming language, by Francois 89;; interesting impure functional programming language. See
90;; Rouaix. See the MMM home page
91;; <URL:http://pauillac.inria.fr/%7Erouaix/mmm/>. 90;; <URL:http://pauillac.inria.fr/%7Erouaix/mmm/>.
92 91
93;; Lynx is now distributed by the FSF. See also 92;; Lynx is now distributed by the FSF. See also
@@ -98,7 +97,8 @@
98;; <URL:http://www.unlv.edu/chimera/>, Arena 97;; <URL:http://www.unlv.edu/chimera/>, Arena
99;; <URL:ftp://ftp.yggdrasil.com/pub/dist/web/arena> and Amaya 98;; <URL:ftp://ftp.yggdrasil.com/pub/dist/web/arena> and Amaya
100;; <URL:ftp://ftp.w3.org/pub/amaya>. mMosaic 99;; <URL:ftp://ftp.w3.org/pub/amaya>. mMosaic
101;; <URL:ftp://sig.enst.fr/pub/multicast/mMosaic/> (with development 100;; <URL:ftp://sig.enst.fr/pub/multicast/mMosaic/>,
101;; <URL:http://sig.enst.fr/~dauphin/mMosaic/> (with development
102;; support for Java applets and multicast) can be used like Mosaic by 102;; support for Java applets and multicast) can be used like Mosaic by
103;; setting `browse-url-mosaic-program' appropriately. 103;; setting `browse-url-mosaic-program' appropriately.
104 104
@@ -223,6 +223,7 @@
223 223
224(eval-when-compile (require 'thingatpt) 224(eval-when-compile (require 'thingatpt)
225 (require 'term) 225 (require 'term)
226 (require 'dired)
226 (require 'w3-auto nil t)) 227 (require 'w3-auto nil t))
227 228
228(defgroup browse-url nil 229(defgroup browse-url nil
@@ -598,16 +599,19 @@ narrowed."
598Prompts for a URL, defaulting to the URL at or before point. Variable 599Prompts for a URL, defaulting to the URL at or before point. Variable
599`browse-url-browser-function' says which browser to use." 600`browse-url-browser-function' says which browser to use."
600 (interactive (browse-url-interactive-arg "URL: ")) 601 (interactive (browse-url-interactive-arg "URL: "))
601 (let ((bf browse-url-browser-function) re) 602 (if (functionp browse-url-browser-function)
602 (unless (functionp bf) 603 (apply browse-url-browser-function url args)
603 (while (consp bf) 604 ;; The `function' can be an alist; look down it for first match
604 (setq re (car (car bf)) 605 ;; and apply the function (which might be a lambda).
605 bf (if (string-match re url) 606 (catch 'done
606 (cdr (car bf)) ; The function 607 (mapcar
607 (cdr bf))))) ; More pairs 608 (lambda (bf)
608 (or bf (error "No browser in browse-url-browser-function matching URL %s" 609 (when (string-match (car bf) url)
609 url)) 610 (apply (cdr bf) url args)
610 (apply bf url args))) 611 (throw 'done t)))
612 browse-url-browser-function)
613 (error "No browser in browse-url-browser-function matching URL %s"
614 url))))
611 615
612;;;###autoload 616;;;###autoload
613(defun browse-url-at-point () 617(defun browse-url-at-point ()