[திங்கள் ஜனவரி 20, 2025] Ihor Radchenko wrote:

> Ihor Radchenko <yanta...@posteo.net> writes:
>
>>>     Ihor> Yes, behind version check, pgtk build check, and, ideally, after
>>>     Ihor> checking that such method is not yet defined.
>>>
>>> The cl-defmethod itself checks itʼs being run in a pgtk emacs, so not
>>> sure we need more than that.
>>
>> The idea is to avoid modifying things outside Org mode unless strictly
>> necessary.
>
> Looks like this patch is not happening unless somebody else (who
> actually uses Emacs GTK build) steps up and creates it against Org mode.
> Visuwesh?

How about the attached?

>From 2f7a6b0c30a64a6bfea0dc32f966e93652541b95 Mon Sep 17 00:00:00 2001
From: Visuwesh <visuwe...@gmail.com>
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
<rpl...@gmail.com> to make yank-media work under GNOME reliably for
Emacs 29.

Link: https://list.orgmode.org/orgmode/87ed7kttoa....@k-7.ch
Reported-by: Sébastien Gendre <s...@k-7.ch>
---
 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....@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

Reply via email to