Autodetect coding system when yanking media

Some browers send eg 'text/html' selections formatted as UTF-8, but
with a type of STRING, which actually means iso-latin-1.  Autodetect
the correct coding system to use by calling 'gui-get-selection'.

* lisp/yank-media.el (yank-media--get-selection): Call
'gui-get-selection' instead of 'gui-backend-get-selection'.
This commit is contained in:
Robert Pluim 2023-06-22 16:59:19 +02:00
parent e0244f5804
commit 587efce9fa

View file

@ -81,7 +81,7 @@ all the different selection types."
(gui-get-selection 'CLIPBOARD 'TARGETS)))
(defun yank-media--get-selection (data-type)
(when-let ((data (gui-backend-get-selection 'CLIPBOARD data-type)))
(when-let ((data (gui-get-selection 'CLIPBOARD data-type)))
(if (string-match-p "\\`text/" (symbol-name data-type))
(yank-media-types--format data-type data)
data)))