diff options
author | Tassilo Horn <tsdh@gnu.org> | 2020-05-06 16:48:57 +0200 |
---|---|---|
committer | Tassilo Horn <tsdh@gnu.org> | 2020-05-06 16:48:57 +0200 |
commit | 4b8e6939bf7664fda33a7aaa03d2d8069358ff7b (patch) | |
tree | ed3411303899b40c3712333315c7b48a6f543c3b /lisp/dnd.el | |
parent | d9e10a1d1a56b8740a276a3fa418f628f79790d0 (diff) | |
download | emacs-4b8e6939bf7664fda33a7aaa03d2d8069358ff7b.tar.gz emacs-4b8e6939bf7664fda33a7aaa03d2d8069358ff7b.tar.bz2 emacs-4b8e6939bf7664fda33a7aaa03d2d8069358ff7b.zip |
Consult browse-url-{default-,}handlers in drag&drop.
* lisp/dnd.el (dnd-handle-one-url): Consult `browse-url-handlers' and
`browse-url-default-handlers' for a matching handler. Adapt
docstring.
* doc/lispref/frames.texi (Drag and Drop): Remove the docs for the
deprecated alist choice of `browse-url-browser-function' and mention
`browse-url-handlers' and `browse-url-default-handlers'.
Diffstat (limited to 'lisp/dnd.el')
-rw-r--r-- | lisp/dnd.el | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/lisp/dnd.el b/lisp/dnd.el index 905659e817b..2f7b16c56ed 100644 --- a/lisp/dnd.el +++ b/lisp/dnd.el @@ -87,12 +87,11 @@ and is the default except for MS-Windows." (defun dnd-handle-one-url (window action url) "Handle one dropped url by calling the appropriate handler. The handler is first located by looking at `dnd-protocol-alist'. -If no match is found here, and the value of `browse-url-browser-function' -is a pair of (REGEXP . FUNCTION), those regexps are tried for a match. -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." +If no match is found here, `browse-url-handlers' and +`browse-url-default-handlers' are searched for a match. +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 @@ -102,14 +101,21 @@ Returns ACTION." (setq ret (funcall (cdr bf) url action)) (throw 'done t))) nil) - (when (not (functionp browse-url-browser-function)) - (catch 'done - (dolist (bf browse-url-browser-function) - (when (string-match (car bf) url) - (setq ret 'private) - (funcall (cdr bf) url action) - (throw 'done t))) - nil)) + (catch 'done + (require 'browse-url) ;; browse-url-handlers is 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))) + nil) (progn (dnd-insert-text window action url) (setq ret 'private))) |