From 2f7a6b0c30a64a6bfea0dc32f966e93652541b95 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Fri, 24 Jan 2025 10:32:15 +0530 Subject: [PATCH] Add workaround to make yank-media work under GNOME for Emacs 29 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/org-compat.el: Add workaround proposed by Robert Pluim to make yank-media work under GNOME reliably for Emacs 29. Link: https://list.orgmode.org/orgmode/87ed7kttoa.fsf@k-7.ch Reported-by: Sébastien Gendre --- lisp/org-compat.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 91192629a..18359a587 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -1992,6 +1992,21 @@ (make-obsolete-variable 'org-speed-commands-user "configure `org-speed-commands' instead." "9.5") (provide 'org-compat) +;;;; yank-media +;; Emacs 29's pgtk port has a bug where it might fail to return the +;; right TARGET. Install a workaround for Emacs <=29 since the fix +;; went to Emacs 30. See bug#72254. +;; Org bug report link: https://list.orgmode.org/orgmode/87ed7kttoa.fsf@k-7.ch +;; This should be removed once we drop Emacs 29 support. +(when (<= emacs-version 29) + (cl-defmethod gui-backend-get-selection ((selection-symbol (eql 'CLIPBOARD)) + (target-type (eql 'TARGETS)) + &context (window-system pgtk)) + (let ((sel (pgtk-get-selection-internal selection-symbol target-type))) + (if (vectorp sel) + sel + (vector sel))))) + ;; Local variables: ;; generated-autoload-file: "org-loaddefs.el" ;; End: -- 2.45.2