Fix inserting selection data into Mozilla programs

* lisp/select.el (xselect-convert-to-text-uri-list): Don't
return any value when converting non-DND selections to this
drag-and-drop target.

Reported by Tobias Bading <tbading@web.de>.
This commit is contained in:
Po Lu 2023-05-03 20:02:01 +08:00
parent 57562c3fd0
commit 8d5aa8df4a

View file

@ -807,19 +807,24 @@ This function returns the string \"emacs\"."
(defun xselect-convert-to-username (_selection _type _value) (defun xselect-convert-to-username (_selection _type _value)
(user-real-login-name)) (user-real-login-name))
(defun xselect-convert-to-text-uri-list (_selection _type value) (defun xselect-convert-to-text-uri-list (selection _type value)
(let ((string ;; While `xselect-uri-list-available-p' ensures that this target
(if (stringp value) ;; will not be reported in the TARGETS of non-drag-and-drop
(xselect--encode-string 'TEXT ;; selections, Firefox stupidly converts to it anyway. Check that
(concat (url-encode-url value) "\n")) ;; the conversion request is being made for the correct selection.
(when (vectorp value) (and (eq selection 'XdndSelection)
(with-temp-buffer (let ((string
(cl-loop for tem across value (if (stringp value)
do (progn (xselect--encode-string 'TEXT
(insert (url-encode-url tem)) (concat (url-encode-url value) "\n"))
(insert "\n"))) (when (vectorp value)
(xselect--encode-string 'TEXT (buffer-string))))))) (with-temp-buffer
(cons 'text/uri-list (cdr string)))) (cl-loop for tem across value
do (progn
(insert (url-encode-url tem))
(insert "\n")))
(xselect--encode-string 'TEXT (buffer-string)))))))
(cons 'text/uri-list (cdr string)))))
(defun xselect-convert-to-xm-file (selection _type value) (defun xselect-convert-to-xm-file (selection _type value)
(when (and (stringp value) (when (and (stringp value)