diff options
author | Tassilo Horn <tsdh@gnu.org> | 2020-05-07 09:53:54 +0200 |
---|---|---|
committer | Tassilo Horn <tsdh@gnu.org> | 2020-05-07 09:53:54 +0200 |
commit | 3b5f728bffb043d623874db29869cc3adf117e43 (patch) | |
tree | 50e6db1cfea67fcacd2caee33631ffd84e943523 /lisp/dnd.el | |
parent | 281b9e42a49c72be48f881f94a5ec33537508118 (diff) | |
download | emacs-3b5f728bffb043d623874db29869cc3adf117e43.tar.gz emacs-3b5f728bffb043d623874db29869cc3adf117e43.tar.bz2 emacs-3b5f728bffb043d623874db29869cc3adf117e43.zip |
Refactor browse-url handler selection into separate function.
* lisp/net/browse-url.el (browse-url-select-handler): New function.
(browse-url): Use it.
* lisp/dnd.el (dnd-handle-one-url): Use it.
Diffstat (limited to 'lisp/dnd.el')
-rw-r--r-- | lisp/dnd.el | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/lisp/dnd.el b/lisp/dnd.el index b649e725f25..c185794d6ea 100644 --- a/lisp/dnd.el +++ b/lisp/dnd.el @@ -92,7 +92,6 @@ If no match is found here, `browse-url-handlers' and If no match is found, just call `dnd-insert-text'. WINDOW is where the drop happened, ACTION is the action for the drop, URL is what has been dropped. Returns ACTION." - (require 'browse-url) (let (ret) (or (catch 'done @@ -102,19 +101,11 @@ is what has been dropped. Returns ACTION." (throw 'done t))) nil) (catch 'done - (defvar browse-url-handlers) ;; Not autoloaded. - (dolist (bf (append - ;; The alist choice of browse-url-browser-function - ;; is deprecated since 28.1, so the (unless ...) - ;; can be removed at some point in time. - (unless (functionp browse-url-browser-function) - browse-url-browser-function) - browse-url-handlers - browse-url-default-handlers)) - (when (string-match (car bf) url) - (setq ret 'private) - (funcall (cdr bf) url action) - (throw 'done t))) + (let ((browser (browse-url-select-handler url))) + (when browser + (setq ret 'private) + (funcall browser url action) + (throw 'done t))) nil) (progn (dnd-insert-text window action url) |