From: Robert Pluim Date: Sun, 16 Jun 2024 12:23:37 +0000 (+0200) Subject: Fix clipboard request on macOS for yank-media X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e388360f9e5f070b561c0ba244b753f2c3e26c07;p=emacs.git Fix clipboard request on macOS for yank-media 'yank-media' makes a request with 'CLIPBOARD and 'TARGETS, which on other platforms returns the type(s) of the current selection, but on macOS returned the selection itself. Make it return the types instead. This fixes (Bug#71377). * src/nsselect.m (ns_get_local_selection): Return nil when called with QCLIPBOARD and QTARGETS, so that 'ns_get_foreign_selection' is called to return the type(s) of the selection. (cherry picked from commit 275a5582414c2f63bccce896200b4e84f1ba0d75) --- diff --git a/src/nsselect.m b/src/nsselect.m index bb6679cd2ab..be52609e21c 100644 --- a/src/nsselect.m +++ b/src/nsselect.m @@ -205,6 +205,14 @@ ns_get_local_selection (Lisp_Object selection_name, Lisp_Object target_type) { Lisp_Object local_value; + /* `yank-media' uses this combination to figure out what the + available types of the selection are. Return nil here so that + ns_get_foreign_selection ends up being called to do that + (Bug#71377). */ + if (EQ (selection_name, QCLIPBOARD) + && EQ (target_type, QTARGETS)) + return Qnil; + local_value = assq_no_quit (selection_name, Vselection_alist); return local_value; }