# HG changeset patch # User Kevin Ryde # Date 1255910116 0 # Node ID f14d7d76a8f2f65acfab0ca8f3e84ebd49d3bff0 # Parent 933cd581fbcf7d6d6c409a6b1aa500f7d0ad6e0e (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.) diff -r 933cd581fbcf -r f14d7d76a8f2 lisp/net/browse-url.el --- a/lisp/net/browse-url.el Sun Oct 18 23:12:02 2009 +0000 +++ b/lisp/net/browse-url.el Sun Oct 18 23:55:16 2009 +0000 @@ -778,20 +778,20 @@ ;; 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)