emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ messages in thread

* Re: Cannot yank media when image come from Gnome screenshot
  2024-07-23 10:47       ` Sébastien Gendre
@ 2024-07-23 10:50         ` Ihor Radchenko
  0 siblings, 0 replies; 13+ messages in thread
From: Ihor Radchenko @ 2024-07-23 10:50 UTC (permalink / raw)
  To: Sébastien Gendre; +Cc: org-mode-email

Sébastien Gendre <seb@k-7.ch> writes:

> 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.

You can try to report as is first. Emacs devs might identify what might
be wrong just from looking at the backtrace.

-- 
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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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
  0 siblings, 0 replies; 13+ 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] 13+ messages in thread

end of thread, other threads:[~2024-08-05 19:07 UTC | newest]

Thread overview: 13+ 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

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).