aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorTassilo Horn2020-05-06 16:48:57 +0200
committerTassilo Horn2020-05-06 16:48:57 +0200
commit4b8e6939bf7664fda33a7aaa03d2d8069358ff7b (patch)
treeed3411303899b40c3712333315c7b48a6f543c3b /lisp
parentd9e10a1d1a56b8740a276a3fa418f628f79790d0 (diff)
downloademacs-4b8e6939bf7664fda33a7aaa03d2d8069358ff7b.tar.gz
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')
-rw-r--r--lisp/dnd.el34
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."
87(defun dnd-handle-one-url (window action url) 87(defun dnd-handle-one-url (window action url)
88 "Handle one dropped url by calling the appropriate handler. 88 "Handle one dropped url by calling the appropriate handler.
89The handler is first located by looking at `dnd-protocol-alist'. 89The handler is first located by looking at `dnd-protocol-alist'.
90If no match is found here, and the value of `browse-url-browser-function' 90If no match is found here, `browse-url-handlers' and
91is a pair of (REGEXP . FUNCTION), those regexps are tried for a match. 91`browse-url-default-handlers' are searched for a match.
92If no match is found, just call `dnd-insert-text'. 92If no match is found, just call `dnd-insert-text'. WINDOW is
93WINDOW is where the drop happened, ACTION is the action for the drop, 93where the drop happened, ACTION is the action for the drop, URL
94URL is what has been dropped. 94is what has been dropped. Returns ACTION."
95Returns ACTION."
96 (require 'browse-url) 95 (require 'browse-url)
97 (let (ret) 96 (let (ret)
98 (or 97 (or
@@ -102,14 +101,21 @@ Returns ACTION."
102 (setq ret (funcall (cdr bf) url action)) 101 (setq ret (funcall (cdr bf) url action))
103 (throw 'done t))) 102 (throw 'done t)))
104 nil) 103 nil)
105 (when (not (functionp browse-url-browser-function)) 104 (catch 'done
106 (catch 'done 105 (require 'browse-url) ;; browse-url-handlers is not autoloaded.
107 (dolist (bf browse-url-browser-function) 106 (dolist (bf (append
108 (when (string-match (car bf) url) 107 ;; The alist choice of browse-url-browser-function
109 (setq ret 'private) 108 ;; is deprecated since 28.1, so the (unless ...)
110 (funcall (cdr bf) url action) 109 ;; can be removed at some point in time.
111 (throw 'done t))) 110 (unless (functionp browse-url-browser-function)
112 nil)) 111 browse-url-browser-function)
112 browse-url-handlers
113 browse-url-default-handlers))
114 (when (string-match (car bf) url)
115 (setq ret 'private)
116 (funcall (cdr bf) url action)
117 (throw 'done t)))
118 nil)
113 (progn 119 (progn
114 (dnd-insert-text window action url) 120 (dnd-insert-text window action url)
115 (setq ret 'private))) 121 (setq ret 'private)))