* Cannot yank media when image come from Gnome screenshot
@ 2024-07-23 8:10 Sébastien Gendre
2024-07-23 9:52 ` Ihor Radchenko
0 siblings, 1 reply; 20+ messages in thread
From: Sébastien Gendre @ 2024-07-23 8:10 UTC (permalink / raw)
To: org-mode-email
[-- Attachment #1: Type: text/plain, Size: 1135 bytes --]
Hello,
I got a bug when I try to yank a screenshot made with Gnome-shell.
I don't know yet if it's a bug with Org-mode handling the media, or the
yank-media function or the Gnome-shell screenshot feature.
What I do:
* From the system menu of Gnome-shell, I choose the action to take a
screenshot
* I took a screenshot from a selected zone, confirm the screenshot and
got a notification message telling me "You can past the screenshot
from the clipboard"
* On an Org-mode document, I place the point where I want to past the
screenshot and call the Emacs function "yank-media"
What I get:
* In the mini-buffer, I get the error message:
"Wrong type argument: sequencep, image/png"
* If I go into the "*Messages*" buffer, the full error message is:
"seq-do: Wrong type argument: sequencep, image/png"
What I expected:
* The image present in the clipboard is attached to the org-mode heading
and a link to this attachment is created under the point
Versions:
* Org-mode: 9.7.2
* Emacs: 29.4
* Gnome-shell: 46.3.1
Best regards
-------
Gendre Sébastien
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2024-07-23 8:10 Cannot yank media when image come from Gnome screenshot Sébastien Gendre
@ 2024-07-23 9:52 ` Ihor Radchenko
2024-07-23 10:24 ` Sébastien Gendre
0 siblings, 1 reply; 20+ messages in thread
From: Ihor Radchenko @ 2024-07-23 9:52 UTC (permalink / raw)
To: Sébastien Gendre; +Cc: org-mode-email
Sébastien Gendre <seb@k-7.ch> writes:
> I got a bug when I try to yank a screenshot made with Gnome-shell.
> I don't know yet if it's a bug with Org-mode handling the media, or the
> yank-media function or the Gnome-shell screenshot feature.
Thanks for reporting!
> What I get:
>
> * In the mini-buffer, I get the error message:
> "Wrong type argument: sequencep, image/png"
>
> * If I go into the "*Messages*" buffer, the full error message is:
> "seq-do: Wrong type argument: sequencep, image/png"
May you please enable debug-on-error (M-x toggle-debug-on-error) and
share the full backtrace displayed when you trigger the error?
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2024-07-23 9:52 ` Ihor Radchenko
@ 2024-07-23 10:24 ` Sébastien Gendre
2024-07-23 10:29 ` Ihor Radchenko
0 siblings, 1 reply; 20+ messages in thread
From: Sébastien Gendre @ 2024-07-23 10:24 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: org-mode-email
[-- Attachment #1: Type: text/plain, Size: 1787 bytes --]
Here is the full backtrace:
Debugger entered--Lisp error: (wrong-type-argument sequencep image/png)
mapc(#f(compiled-function (elt) #<bytecode 0x1ebc9d0d6093f55d>) image/png)
seq-do(#f(compiled-function (elt) #<bytecode 0x1ebc9d0d6093f55d>) image/png)
#f(compiled-function #'sequence #<bytecode 0x19945316743f723a>)(#f(compiled-function (elt) #<bytecode 0x94038afefa059ab>) image/png)
apply(#f(compiled-function #'sequence #<bytecode 0x19945316743f723a>) #f(compiled-function (elt) #<bytecode 0x94038afefa059ab>) image/png nil)
seq-map(#f(compiled-function (elt) #<bytecode 0x94038afefa059ab>) image/png)
seq-filter(#f(compiled-function (type) #<bytecode 0x17bbb7cb3b4b0c6d>) image/png)
yank-media--find-matching-media("x/special-\\(?:gnome|KDE|mate\\)-files")
yank-media()
funcall-interactively(yank-media)
command-execute(yank-media record)
execute-extended-command(nil "yank-media" "yank")
funcall-interactively(execute-extended-command nil "yank-media" "yank")
command-execute(execute-extended-command)
Ihor Radchenko <yantar92@posteo.net> writes:
> Sébastien Gendre <seb@k-7.ch> writes:
>
>> I got a bug when I try to yank a screenshot made with Gnome-shell.
>> I don't know yet if it's a bug with Org-mode handling the media, or the
>> yank-media function or the Gnome-shell screenshot feature.
>
> Thanks for reporting!
>
>> What I get:
>>
>> * In the mini-buffer, I get the error message:
>> "Wrong type argument: sequencep, image/png"
>>
>> * If I go into the "*Messages*" buffer, the full error message is:
>> "seq-do: Wrong type argument: sequencep, image/png"
>
> May you please enable debug-on-error (M-x toggle-debug-on-error) and
> share the full backtrace displayed when you trigger the error?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2024-07-23 10:24 ` Sébastien Gendre
@ 2024-07-23 10:29 ` Ihor Radchenko
2024-07-23 10:47 ` Sébastien Gendre
2024-07-26 18:35 ` Ihor Radchenko
0 siblings, 2 replies; 20+ messages in thread
From: Ihor Radchenko @ 2024-07-23 10:29 UTC (permalink / raw)
To: Sébastien Gendre; +Cc: org-mode-email
Sébastien Gendre <seb@k-7.ch> writes:
> Here is the full backtrace:
>
>
> Debugger entered--Lisp error: (wrong-type-argument sequencep image/png)
> mapc(#f(compiled-function (elt) #<bytecode 0x1ebc9d0d6093f55d>) image/png)
> seq-do(#f(compiled-function (elt) #<bytecode 0x1ebc9d0d6093f55d>) image/png)
> #f(compiled-function #'sequence #<bytecode 0x19945316743f723a>)(#f(compiled-function (elt) #<bytecode 0x94038afefa059ab>) image/png)
> apply(#f(compiled-function #'sequence #<bytecode 0x19945316743f723a>) #f(compiled-function (elt) #<bytecode 0x94038afefa059ab>) image/png nil)
> seq-map(#f(compiled-function (elt) #<bytecode 0x94038afefa059ab>) image/png)
> seq-filter(#f(compiled-function (type) #<bytecode 0x17bbb7cb3b4b0c6d>) image/png)
The error is originating from Emacs itself, not from Org mode.
May you try newer version of Emacs? If you still see the error, please
report it as Emacs bug.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2024-07-23 10:29 ` Ihor Radchenko
@ 2024-07-23 10:47 ` Sébastien Gendre
2024-07-23 10:50 ` Ihor Radchenko
2024-07-26 18:35 ` Ihor Radchenko
1 sibling, 1 reply; 20+ messages in thread
From: Sébastien Gendre @ 2024-07-23 10:47 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: org-mode-email
[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]
Thank you for your reply.
I use the Emacs version provided on Fedora 40.
I will look how to compile a more recent version of Emacs and test it.
Ihor Radchenko <yantar92@posteo.net> writes:
> Sébastien Gendre <seb@k-7.ch> writes:
>
>> Here is the full backtrace:
>>
>>
>> Debugger entered--Lisp error: (wrong-type-argument sequencep image/png)
>> mapc(#f(compiled-function (elt) #<bytecode 0x1ebc9d0d6093f55d>) image/png)
>> seq-do(#f(compiled-function (elt) #<bytecode 0x1ebc9d0d6093f55d>) image/png)
>> #f(compiled-function #'sequence #<bytecode 0x19945316743f723a>)(#f(compiled-function (elt) #<bytecode 0x94038afefa059ab>) image/png)
>> apply(#f(compiled-function #'sequence #<bytecode 0x19945316743f723a>) #f(compiled-function (elt) #<bytecode 0x94038afefa059ab>) image/png nil)
>> seq-map(#f(compiled-function (elt) #<bytecode 0x94038afefa059ab>) image/png)
>> seq-filter(#f(compiled-function (type) #<bytecode 0x17bbb7cb3b4b0c6d>) image/png)
>
> The error is originating from Emacs itself, not from Org mode.
> May you try newer version of Emacs? If you still see the error, please
> report it as Emacs bug.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2024-07-23 10:29 ` Ihor Radchenko
2024-07-23 10:47 ` Sébastien Gendre
@ 2024-07-26 18:35 ` Ihor Radchenko
2024-08-01 6:07 ` Visuwesh
1 sibling, 1 reply; 20+ messages in thread
From: Ihor Radchenko @ 2024-07-26 18:35 UTC (permalink / raw)
To: Sébastien Gendre; +Cc: org-mode-email
Ihor Radchenko <yantar92@posteo.net> writes:
> ...
> The error is originating from Emacs itself, not from Org mode.
Sébastien reporting this upstream as bug#72254.
The bug has been fixed and will become available in Emacs 30 release.
The bug fix involved modifying Emacs C code, so we cannot do anything
more to work around the problem on Org side.
Fixed.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2024-07-26 18:35 ` Ihor Radchenko
@ 2024-08-01 6:07 ` Visuwesh
2024-08-04 19:01 ` Ihor Radchenko
0 siblings, 1 reply; 20+ messages in thread
From: Visuwesh @ 2024-08-01 6:07 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Sébastien Gendre, org-mode-email
[வெள்ளி ஜூலை 26, 2024] Ihor Radchenko wrote:
> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> ...
>> The error is originating from Emacs itself, not from Org mode.
>
> Sébastien reporting this upstream as bug#72254.
> The bug has been fixed and will become available in Emacs 30 release.
> The bug fix involved modifying Emacs C code, so we cannot do anything
> more to work around the problem on Org side.
Perhaps, you can have the patch posted by Robert as a workaround for
Emacs<30? Patch is in https://yhetil.org/87wmlb8djy.fsf@gmail.com, and
Sébastien confirmed that it worked.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2024-08-01 6:07 ` Visuwesh
@ 2024-08-04 19:01 ` Ihor Radchenko
2024-08-05 15:32 ` Robert Pluim
0 siblings, 1 reply; 20+ messages in thread
From: Ihor Radchenko @ 2024-08-04 19:01 UTC (permalink / raw)
To: Visuwesh, Robert Pluim; +Cc: Sébastien Gendre, org-mode-email
Visuwesh <visuweshm@gmail.com> writes:
>>> The error is originating from Emacs itself, not from Org mode.
>>
>> Sébastien reporting this upstream as bug#72254.
>> The bug has been fixed and will become available in Emacs 30 release.
>> The bug fix involved modifying Emacs C code, so we cannot do anything
>> more to work around the problem on Org side.
>
> Perhaps, you can have the patch posted by Robert as a workaround for
> Emacs<30? Patch is in https://yhetil.org/87wmlb8djy.fsf@gmail.com, and
> Sébastien confirmed that it worked.
I am not sure if I like patching Emacs functions when loading Org mode.
On the other hand, I do not see any obvious downside.
Robert, what do you think about such idea?
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2024-08-04 19:01 ` Ihor Radchenko
@ 2024-08-05 15:32 ` Robert Pluim
2024-08-05 17:44 ` Ihor Radchenko
0 siblings, 1 reply; 20+ messages in thread
From: Robert Pluim @ 2024-08-05 15:32 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Visuwesh, Sébastien Gendre, org-mode-email
>>>>> On Sun, 04 Aug 2024 19:01:24 +0000, Ihor Radchenko <yantar92@posteo.net> said:
Ihor> I am not sure if I like patching Emacs functions when loading Org mode.
Ihor> On the other hand, I do not see any obvious downside.
I was hoping youʼd have a strong opinion 😀
Ihor> Robert, what do you think about such idea?
Itʼs a cl-defmethod that I assume you will hide behind a version
check, and the changed code itself should only run for a pgtk emacs,
so I donʼt see a great risk. And in the absolute worst case
`yank-media' doesnʼt work, which is the situation we already have.
Robert
--
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2024-08-05 15:32 ` Robert Pluim
@ 2024-08-05 17:44 ` Ihor Radchenko
2024-08-05 19:03 ` Robert Pluim
0 siblings, 1 reply; 20+ messages in thread
From: Ihor Radchenko @ 2024-08-05 17:44 UTC (permalink / raw)
To: Robert Pluim; +Cc: Visuwesh, Sébastien Gendre, org-mode-email
Robert Pluim <rpluim@gmail.com> writes:
>>>>>> On Sun, 04 Aug 2024 19:01:24 +0000, Ihor Radchenko <yantar92@posteo.net> said:
>
> Ihor> I am not sure if I like patching Emacs functions when loading Org mode.
> Ihor> On the other hand, I do not see any obvious downside.
>
> I was hoping youʼd have a strong opinion 😀
Generally speaking, defining global methods is a very bad practice.
But I feel that it _might_ be justified in this particular case.
> Ihor> Robert, what do you think about such idea?
>
> Itʼs a cl-defmethod that I assume you will hide behind a version
> check, and the changed code itself should only run for a pgtk emacs,
> so I donʼt see a great risk. And in the absolute worst case
> `yank-media' doesnʼt work, which is the situation we already have.
Yes, behind version check, pgtk build check, and, ideally, after
checking that such method is not yet defined.
May you create such a patch against Org mode repository?
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2024-08-05 17:44 ` Ihor Radchenko
@ 2024-08-05 19:03 ` Robert Pluim
2024-08-05 19:07 ` Ihor Radchenko
0 siblings, 1 reply; 20+ messages in thread
From: Robert Pluim @ 2024-08-05 19:03 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Visuwesh, Sébastien Gendre, org-mode-email
>>>>> On Mon, 05 Aug 2024 17:44:43 +0000, Ihor Radchenko <yantar92@posteo.net> said:
Ihor> Robert Pluim <rpluim@gmail.com> writes:
>>>>>>> On Sun, 04 Aug 2024 19:01:24 +0000, Ihor Radchenko <yantar92@posteo.net> said:
>>
Ihor> I am not sure if I like patching Emacs functions when loading Org mode.
Ihor> On the other hand, I do not see any obvious downside.
>>
>> I was hoping youʼd have a strong opinion 😀
Ihor> Generally speaking, defining global methods is a very bad practice.
Ihor> But I feel that it _might_ be justified in this particular case.
Itʼs a specialised global method, so itʼs not too bad
Ihor> Robert, what do you think about such idea?
>>
>> Itʼs a cl-defmethod that I assume you will hide behind a version
>> check, and the changed code itself should only run for a pgtk emacs,
>> so I donʼt see a great risk. And in the absolute worst case
>> `yank-media' doesnʼt work, which is the situation we already have.
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.
Ihor> May you create such a patch against Org mode repository?
This week I am a bit busy, so not before middle of next week at the
earliest.
Robert
--
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2024-08-05 19:03 ` Robert Pluim
@ 2024-08-05 19:07 ` Ihor Radchenko
2025-01-12 17:58 ` Ihor Radchenko
2025-01-20 18:58 ` Ihor Radchenko
0 siblings, 2 replies; 20+ messages in thread
From: Ihor Radchenko @ 2024-08-05 19:07 UTC (permalink / raw)
To: Robert Pluim; +Cc: Visuwesh, Sébastien Gendre, org-mode-email
Robert Pluim <rpluim@gmail.com> 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.
> Ihor> May you create such a patch against Org mode repository?
>
> This week I am a bit busy, so not before middle of next week at the
> earliest.
No problem. There is no rush.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2024-08-05 19:07 ` Ihor Radchenko
@ 2025-01-12 17:58 ` Ihor Radchenko
2025-01-20 18:58 ` Ihor Radchenko
1 sibling, 0 replies; 20+ messages in thread
From: Ihor Radchenko @ 2025-01-12 17:58 UTC (permalink / raw)
To: Robert Pluim; +Cc: Visuwesh, Sébastien Gendre, org-mode-email
Ihor Radchenko <yantar92@posteo.net> writes:
>> Ihor> May you create such a patch against Org mode repository?
>>
>> This week I am a bit busy, so not before middle of next week at the
>> earliest.
Looks like this thread slipped through the cracks.
Robert, are you still interested in creating the patch?
--
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2024-08-05 19:07 ` Ihor Radchenko
2025-01-12 17:58 ` Ihor Radchenko
@ 2025-01-20 18:58 ` Ihor Radchenko
2025-01-21 4:07 ` Visuwesh
2025-01-24 5:02 ` Visuwesh
1 sibling, 2 replies; 20+ messages in thread
From: Ihor Radchenko @ 2025-01-20 18:58 UTC (permalink / raw)
To: Robert Pluim; +Cc: Visuwesh, Sébastien Gendre, org-mode-email
Ihor Radchenko <yantar92@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?
--
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2025-01-20 18:58 ` Ihor Radchenko
@ 2025-01-21 4:07 ` Visuwesh
2025-01-24 5:02 ` Visuwesh
1 sibling, 0 replies; 20+ messages in thread
From: Visuwesh @ 2025-01-21 4:07 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Robert Pluim, Sébastien Gendre, org-mode-email
[திங்கள் ஜனவரி 20, 2025] Ihor Radchenko wrote:
> Ihor Radchenko <yantar92@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?
I will have a look when I have time. (I don't use the GTK build
though.)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2025-01-20 18:58 ` Ihor Radchenko
2025-01-21 4:07 ` Visuwesh
@ 2025-01-24 5:02 ` Visuwesh
2025-01-24 5:07 ` Visuwesh
1 sibling, 1 reply; 20+ messages in thread
From: Visuwesh @ 2025-01-24 5:02 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Robert Pluim, Sébastien Gendre, org-mode-email
[-- Attachment #1: Type: text/plain, Size: 664 bytes --]
[திங்கள் ஜனவரி 20, 2025] Ihor Radchenko wrote:
> Ihor Radchenko <yantar92@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?
[-- Attachment #2: 0001-Add-workaround-to-make-yank-media-work-under-GNOME-f.patch --]
[-- Type: text/x-diff, Size: 1823 bytes --]
From 2f7a6b0c30a64a6bfea0dc32f966e93652541b95 Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@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
<rpluim@gmail.com> 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 <seb@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.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
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2025-01-24 5:02 ` Visuwesh
@ 2025-01-24 5:07 ` Visuwesh
2025-01-24 10:50 ` Robert Pluim
0 siblings, 1 reply; 20+ messages in thread
From: Visuwesh @ 2025-01-24 5:07 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Robert Pluim, Sébastien Gendre, org-mode-email
[-- Attachment #1: Type: text/plain, Size: 829 bytes --]
[வெள்ளி ஜனவரி 24, 2025] Visuwesh wrote:
> [திங்கள் ஜனவரி 20, 2025] Ihor Radchenko wrote:
>
>> Ihor Radchenko <yantar92@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?
Ooops, made a silly mistake. Still need more coffee. Sorry for the
noise!
[-- Attachment #2: 0001-Add-workaround-to-make-yank-media-work-under-GNOME-f.patch --]
[-- Type: text/x-diff, Size: 1829 bytes --]
From 0b8cc3d8ff40416c8fbb202e3c94fcf471a21f5d Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@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
<rpluim@gmail.com> 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 <seb@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..3ad330628 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-major-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
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2025-01-24 5:07 ` Visuwesh
@ 2025-01-24 10:50 ` Robert Pluim
2025-01-24 12:57 ` Visuwesh
0 siblings, 1 reply; 20+ messages in thread
From: Robert Pluim @ 2025-01-24 10:50 UTC (permalink / raw)
To: Visuwesh; +Cc: Ihor Radchenko, Sébastien Gendre, org-mode-email
>>>>> On Fri, 24 Jan 2025 10:37:37 +0530, Visuwesh <visuweshm@gmail.com> said:
Visuwesh> * lisp/org-compat.el: Add workaround proposed by Robert Pluim
Visuwesh> <rpluim@gmail.com> to make yank-media work under GNOME reliably for
Visuwesh> Emacs 29.
Did I propose it? I donʼt remember 😀
Visuwesh> Link: https://list.orgmode.org/orgmode/87ed7kttoa.fsf@k-7.ch
Visuwesh> Reported-by: Sébastien Gendre <seb@k-7.ch>
Visuwesh> ---
Visuwesh> lisp/org-compat.el | 15 +++++++++++++++
Visuwesh> 1 file changed, 15 insertions(+)
Visuwesh> diff --git a/lisp/org-compat.el b/lisp/org-compat.el
Visuwesh> index 91192629a..3ad330628 100644
Visuwesh> --- a/lisp/org-compat.el
Visuwesh> +++ b/lisp/org-compat.el
Visuwesh> @@ -1992,6 +1992,21 @@ (make-obsolete-variable 'org-speed-commands-user
Visuwesh> "configure `org-speed-commands' instead." "9.5")
Visuwesh> (provide 'org-compat)
Visuwesh> +;;;; yank-media
Visuwesh> +;; Emacs 29's pgtk port has a bug where it might fail to return the
Visuwesh> +;; right TARGET. Install a workaround for Emacs <=29 since the fix
Visuwesh> +;; went to Emacs 30. See bug#72254.
Visuwesh> +;; Org bug report link: https://list.orgmode.org/orgmode/87ed7kttoa.fsf@k-7.ch
Visuwesh> +;; This should be removed once we drop Emacs 29 support.
Visuwesh> +(when (<= emacs-major-version 29)
I thought Ihor wanted this to check for a pgtk build? Personally I
think the check for the window system in the cl-defmethod is enough,
but Iʼm not Ihor.
One way to check for pgtk is checking the result of
(window-system). Or checking whether `pgtk-backend-display-class' is `fboundp'.
Visuwesh> + (cl-defmethod gui-backend-get-selection ((selection-symbol (eql 'CLIPBOARD))
Visuwesh> + (target-type (eql 'TARGETS))
Visuwesh> + &context (window-system pgtk))
Visuwesh> + (let ((sel (pgtk-get-selection-internal selection-symbol target-type)))
Visuwesh> + (if (vectorp sel)
Visuwesh> + sel
Visuwesh> + (vector sel)))))
Visuwesh> +
Visuwesh> ;; Local variables:
Visuwesh> ;; generated-autoload-file: "org-loaddefs.el"
Visuwesh> ;; End:
Visuwesh> --
Visuwesh> 2.45.2
Robert
--
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Cannot yank media when image come from Gnome screenshot
2025-01-24 10:50 ` Robert Pluim
@ 2025-01-24 12:57 ` Visuwesh
0 siblings, 0 replies; 20+ messages in thread
From: Visuwesh @ 2025-01-24 12:57 UTC (permalink / raw)
To: Robert Pluim; +Cc: Ihor Radchenko, Sébastien Gendre, org-mode-email
[வெள்ளி ஜனவரி 24, 2025] Robert Pluim wrote:
>>>>>> On Fri, 24 Jan 2025 10:37:37 +0530, Visuwesh <visuweshm@gmail.com> said:
>
> Visuwesh> * lisp/org-compat.el: Add workaround proposed by Robert Pluim
> Visuwesh> <rpluim@gmail.com> to make yank-media work under GNOME reliably for
> Visuwesh> Emacs 29.
>
> Did I propose it? I donʼt remember 😀
You did, indeed. See https://yhetil.org/87wmlb8djy.fsf@gmail.com.
> Visuwesh> Link: https://list.orgmode.org/orgmode/87ed7kttoa.fsf@k-7.ch
> Visuwesh> Reported-by: Sébastien Gendre <seb@k-7.ch>
> Visuwesh> ---
> Visuwesh> lisp/org-compat.el | 15 +++++++++++++++
> Visuwesh> 1 file changed, 15 insertions(+)
>
> Visuwesh> diff --git a/lisp/org-compat.el b/lisp/org-compat.el
> Visuwesh> index 91192629a..3ad330628 100644
> Visuwesh> --- a/lisp/org-compat.el
> Visuwesh> +++ b/lisp/org-compat.el
> Visuwesh> @@ -1992,6 +1992,21 @@ (make-obsolete-variable 'org-speed-commands-user
> Visuwesh> "configure `org-speed-commands' instead." "9.5")
> Visuwesh> (provide 'org-compat)
>
> Visuwesh> +;;;; yank-media
> Visuwesh> +;; Emacs 29's pgtk port has a bug where it might fail to return the
> Visuwesh> +;; right TARGET. Install a workaround for Emacs <=29 since the fix
> Visuwesh> +;; went to Emacs 30. See bug#72254.
> Visuwesh> +;; Org bug report link: https://list.orgmode.org/orgmode/87ed7kttoa.fsf@k-7.ch
> Visuwesh> +;; This should be removed once we drop Emacs 29 support.
> Visuwesh> +(when (<= emacs-major-version 29)
>
> I thought Ihor wanted this to check for a pgtk build? Personally I
> think the check for the window system in the cl-defmethod is enough,
> but Iʼm not Ihor.
I think so too but let's hear from Ihor first.
> One way to check for pgtk is checking the result of
> (window-system). Or checking whether `pgtk-backend-display-class' is
> `fboundp'.
I don't think we should use (window-system) since the return value is
FRAME dependent: if Someone™ opens a terminal frame first and loads Org
while it is focused, they won't get this fix even if their build is a
pgtk build. C:
[ I think this will definitely break for daemon processes. ]
We could rely on (fboundp 'pgtk-backend-display-class) but I somehow
don't like it as compared to just leaving this extra check out.
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2025-01-24 12:58 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-23 8:10 Cannot yank media when image come from Gnome screenshot Sébastien Gendre
2024-07-23 9:52 ` Ihor Radchenko
2024-07-23 10:24 ` Sébastien Gendre
2024-07-23 10:29 ` Ihor Radchenko
2024-07-23 10:47 ` Sébastien Gendre
2024-07-23 10:50 ` Ihor Radchenko
2024-07-26 18:35 ` Ihor Radchenko
2024-08-01 6:07 ` Visuwesh
2024-08-04 19:01 ` Ihor Radchenko
2024-08-05 15:32 ` Robert Pluim
2024-08-05 17:44 ` Ihor Radchenko
2024-08-05 19:03 ` Robert Pluim
2024-08-05 19:07 ` Ihor Radchenko
2025-01-12 17:58 ` Ihor Radchenko
2025-01-20 18:58 ` Ihor Radchenko
2025-01-21 4:07 ` Visuwesh
2025-01-24 5:02 ` Visuwesh
2025-01-24 5:07 ` Visuwesh
2025-01-24 10:50 ` Robert Pluim
2025-01-24 12:57 ` Visuwesh
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).