diff options
| author | Kevin Ryde | 2009-10-18 23:55:16 +0000 |
|---|---|---|
| committer | Kevin Ryde | 2009-10-18 23:55:16 +0000 |
| commit | 9c16fc95402b4ee2c90242868c2f5b9a1bcbc8e5 (patch) | |
| tree | 74627af578f0c5f9dce8620a3a0bbb7d1435cae3 | |
| parent | b0b0ef98fb002d2d13eac5c7c0315a63d4a35cf4 (diff) | |
| download | emacs-9c16fc95402b4ee2c90242868c2f5b9a1bcbc8e5.tar.gz emacs-9c16fc95402b4ee2c90242868c2f5b9a1bcbc8e5.zip | |
(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.)
| -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 | |||
| 778 | ;; which may not even exist any more. | 778 | ;; which may not even exist any more. |
| 779 | (if (stringp (frame-parameter (selected-frame) 'display)) | 779 | (if (stringp (frame-parameter (selected-frame) 'display)) |
| 780 | (setenv "DISPLAY" (frame-parameter (selected-frame) 'display))) | 780 | (setenv "DISPLAY" (frame-parameter (selected-frame) 'display))) |
| 781 | ;; Send any symbol to `apply', not just fboundp ones, since void-function | 781 | (if (and (consp browse-url-browser-function) |
| 782 | ;; from apply is clearer than wrong-type-argument from dolist. | 782 | (not (functionp browse-url-browser-function))) |
| 783 | (if (or (symbolp browse-url-browser-function) | 783 | ;; The `function' can be an alist; look down it for first match |
| 784 | (functionp browse-url-browser-function)) | 784 | ;; and apply the function (which might be a lambda). |
| 785 | (apply browse-url-browser-function url args) | 785 | (catch 'done |
| 786 | ;; The `function' can be an alist; look down it for first match | 786 | (dolist (bf browse-url-browser-function) |
| 787 | ;; and apply the function (which might be a lambda). | 787 | (when (string-match (car bf) url) |
| 788 | (catch 'done | 788 | (apply (cdr bf) url args) |
| 789 | (dolist (bf browse-url-browser-function) | 789 | (throw 'done t))) |
| 790 | (when (string-match (car bf) url) | 790 | (error "No browse-url-browser-function matching URL %s" |
| 791 | (apply (cdr bf) url args) | 791 | url)) |
| 792 | (throw 'done t))) | 792 | ;; Unbound symbols go down this leg, since void-function from |
| 793 | (error "No browse-url-browser-function matching URL %s" | 793 | ;; apply is clearer than wrong-type-argument from dolist. |
| 794 | url))))) | 794 | (apply browse-url-browser-function url args)))) |
| 795 | 795 | ||
| 796 | ;;;###autoload | 796 | ;;;###autoload |
| 797 | (defun browse-url-at-point (&optional arg) | 797 | (defun browse-url-at-point (&optional arg) |