diff options
author | Kevin Ryde <user42@zip.com.au> | 2009-10-18 23:55:16 +0000 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2009-10-18 23:55:16 +0000 |
commit | 9c16fc95402b4ee2c90242868c2f5b9a1bcbc8e5 (patch) | |
tree | 74627af578f0c5f9dce8620a3a0bbb7d1435cae3 /lisp/net/browse-url.el | |
parent | b0b0ef98fb002d2d13eac5c7c0315a63d4a35cf4 (diff) | |
download | emacs-9c16fc95402b4ee2c90242868c2f5b9a1bcbc8e5.tar.gz |
(browse-url): Identify alist with "consp and
not functionp" and let all other things go down the `apply' leg,
as suggested by Stefan. (Further to bug#4531.)
Diffstat (limited to 'lisp/net/browse-url.el')
-rw-r--r-- | lisp/net/browse-url.el | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index ead2a39c9d4..2f8304771cd 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -778,20 +778,20 @@ Prompts for a URL, defaulting to the URL at or before point. Variable ;; which may not even exist any more. (if (stringp (frame-parameter (selected-frame) 'display)) (setenv "DISPLAY" (frame-parameter (selected-frame) 'display))) - ;; Send any symbol to `apply', not just fboundp ones, since void-function - ;; from apply is clearer than wrong-type-argument from dolist. - (if (or (symbolp browse-url-browser-function) - (functionp browse-url-browser-function)) - (apply browse-url-browser-function url args) - ;; The `function' can be an alist; look down it for first match - ;; and apply the function (which might be a lambda). - (catch 'done - (dolist (bf browse-url-browser-function) - (when (string-match (car bf) url) - (apply (cdr bf) url args) - (throw 'done t))) - (error "No browse-url-browser-function matching URL %s" - url))))) + (if (and (consp browse-url-browser-function) + (not (functionp browse-url-browser-function))) + ;; The `function' can be an alist; look down it for first match + ;; and apply the function (which might be a lambda). + (catch 'done + (dolist (bf browse-url-browser-function) + (when (string-match (car bf) url) + (apply (cdr bf) url args) + (throw 'done t))) + (error "No browse-url-browser-function matching URL %s" + url)) + ;; Unbound symbols go down this leg, since void-function from + ;; apply is clearer than wrong-type-argument from dolist. + (apply browse-url-browser-function url args)))) ;;;###autoload (defun browse-url-at-point (&optional arg) |