GNU bug report logs - #53894
27.2; Clipboard copy -> C-y -> M-y -> Same clipboard copy does not push to kill ring

Previous Next

Package: emacs;

Reported by: Ignacio Casso <ignaciocasso <at> hotmail.com>

Date: Wed, 9 Feb 2022 09:35:01 UTC

Severity: normal

Tags: patch

Found in version 27.2

Done: Po Lu <luangruo <at> yahoo.com>

Bug is archived. No further changes may be made.

Full log


Message #119 received at 53894 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Ignacio Casso <ignaciocasso <at> hotmail.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 53894 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#53894: 27.2; Clipboard copy -> C-y -> M-y -> Same clipboard
 copy does not push to kill ring
Date: Mon, 28 Feb 2022 21:48:23 +0800
Ignacio Casso <ignaciocasso <at> hotmail.com> writes:

> Here I have not replaced the variable, since I have assumed that code
> under the obsolete/ directory does not need to be maintained, and C-h
> f tells me that function is not loaded by default. However there is a
> warning when compiling. Should I fix it?

I can do that instead, but see below.

> - Using new variables gui--last-clipboard-selection-fingerprint and
>   gui--last-primary-selection-fingerprint instead of
>   gui--last-selected-text-clipboard and
>   gui--last-selected-text-primary. They have the same purpose but hold
>   the text and the timestamp instead of just the text, and I have
>   updated the code everywhere they were referenced to use the
>   text-timestamp pair instead of just the text . Better ideas for the
>   names are welcome.

Can't you put a `timestamp' text property on strings stored inside the
old gui--last-selected-text-clipboard variable instead?

> - Just threw the idea that a better fingerprint would include the owner
>   of the selection, if timestamps are sometimes not updated precisely
>   when the owner changes, as Po Lu said.

What I said is that badly behaved clients do not change the timestamp to
take into account new data becoming available for clients they already
own.  The X server ensures that timestamps always increase with
selection ownership changes.

>> diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el
>> index 327d51f275..2ae3cbd8b2 100644
>> --- a/lisp/term/pc-win.el
>> +++ b/lisp/term/pc-win.el
>> @@ -248,7 +248,7 @@ w16-selection-owner-p
>>          ;; Windows clipboard.
>>          (cond
>>           ((not text) t)
>> -         ((equal text gui--last-selected-text-clipboard) text)
>> +         ((equal text (car gui--last-clipbaord-selection-fingerprint)) t)
>>           (t nil)))))
>>  

> - Have not tested since I don't use Windows, but it's semantically
>   equivalent as before.

pc-win is for the MS-DOS port (which does work, and should be kept
working.)  However, I think this modification can be avoided by storing
the timestamp as a text property, which I proposed above.

Thanks.




This bug report was last modified 3 years and 51 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.