branch: externals-release/org commit 971b0577402c3aeff8e1e27f5de3c7332a45dba6 Author: Visuwesh <visuwe...@gmail.com> Commit: Ihor Radchenko <yanta...@posteo.net>
Add workaround to make yank-media work under GNOME for Emacs 29 * 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 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 4c4178dbc8..011d012355 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -1815,6 +1815,26 @@ key." "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 (and (fboundp 'pgtk-get-selection-internal) + (<= emacs-major-version 29)) + ;; Only define the method if it hasn't been previously defined. + (unless (cl-find-method 'gui-backend-get-selection nil + '((eql 'CLIPBOARD) (eql 'TARGETS) + ((&context . window-system) eql 'pgtk))) + (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: