Subject: bug#65892: 30.0.50; yank-media fails for clipboard selection that are wiped after being accessed

From: Po Lu <[email-masked]>
Date: Tue, 25 Jun 2024 11:45:34 +0800

Visuwesh <[email-masked]> writes:

> [திங்கள் ஜூன் 24, 2024] Eli Zaretskii wrote:
>
>>> From: Visuwesh <[email-masked]>
>>> Date: Mon, 24 Jun 2024 09:23:20 +0530
>>> 
>>> I apologise for neglecting to speak out loud before the emacs-30 branch
>>> cut.  Is there a chance to get this patch in emacs-30?  I am using this
>>> patch ever since I sent it to debbugs and I do not face any issue wrt
>>> the pcmanfm issue shown here and other applications which do not wipe
>>> the clipboard.  It would be nice to have it in emacs-30 especially with
>>> org-mode gaining yank-media support for files copied/cut from a file
>>> manager.
>>
>> I can be convinced to make such changes on the release branch only if
>> all they do is make a function whose return value was not interesting
>> to return a useful value.  But the patch does more than that: it
>> introduces pcase-dolist and replaces some FOO with (car FOO) in at
>> least 3 occasions.  
>
> Thanks for the review and consideration, Eli.  The patch only touched
> the return value of a helper function.
>
>> Such changes make me uncomfortable, especially given that this is a
>> case where Emacs needs to jump through hoops to work around
>> misfeatures of some 3rd-party utility.
>
> I suspect similar behaviour will be shown by other file managers.
>
>> Can you rewrite the patch so that it will be clear at a glance that it
>> cannot possibly cause any harm because it just causes the same code
>> return a value?  If you can, we have a chance of installing this on
>> the emacs-30 branch.
>
> I hope the attached patch makes the intent clear.  I added a doc-string
> to the internal function too, and removed pcase-dolist and extra car to
> make the code simpler.
>
>> And, btw, I wonder whether enough people use pcmanfm for us to bother
>> about this issue.
>
> AFAIK, pcmanfm is fairly popular among the window manager users crowd
> due to its light-weight.

I suspect another implication of this is that pcmanfm is actively
developed, so is there any chance of your filing a request with their
developers that they not disclaim ownership of selections after
responding to a request?  It is a very peculiar action for any X client,
and surely it's not only Emacs that is or will be affected.