bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#53894: 27.2; Clipboard copy -> C-y -> M-y -> Same clipboard copy doe


From: Po Lu
Subject: bug#53894: 27.2; Clipboard copy -> C-y -> M-y -> Same clipboard copy does not push to kill ring
Date: Fri, 11 Feb 2022 09:05:13 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

Ignacio Casso <ignaciocasso@hotmail.com> writes:

> That logic is still necessary. gui-selection-value is called every time
> we yank, and we only want it to return non-nil when there is something
> new there. If there is, it's pushed to the top of the kill ring and
> yanked, and from then onwards the kill ring handles it. Otherwise, i.e.,
> if its the same as gui--last-selected-text-clipboard, it returns nil. So
> gui-selection-value will almost always return nil for that reason, and
> it's in fact gui-backend-selection-owner-p what is probably unnecessary,
> since it achieves the same as setting gui--last-selected-text-clipboard
> to the string being killed in the first place, which gui-select-text
> already does.
>
> In particular, removing that logic would not solve the problem I
> reported. The only way to solve it would be with clipboard
> timestamps, which are probably not worth to use if this is the only
> problem they solve (although I saw a comment about them being needed
> also to resolve discrepancies between clipboard and primary selection).

You have the wrong mental model of how X selections work.  You can't
"set" a selection, but instead you assert ownership of it, which means
other clients will then ask you for its contents.  (Which are always
kept by you, and never sent to the X server, unless you exit and a
clipboard manager is willing to take ownership of the selection.)

If Emacs wants to get the value of CLIPBOARD, then it has to first find
out which client has ownership of that selection, and to ask it for the
value of CLIPBOARD.  If that ownership information is unavailable, then
selections will not work at all, so the selection ownership information
is guaranteed to be reliable as long as selections are working.

Other clipboard systems typically have a counter that is atomically
incremented each time something is saved to the clipboard.  The client
can save the value of the counter before it has saved something to the
clipboard, and compare that to the current value of the counter, to
determine whether or not it was the last client to have set the value of
the clipboard.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]