From: Ignacio Casso <ignaciocasso@hotmail.com>
To: Po Lu <luangruo@yahoo.com>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, 53894@debbugs.gnu.org
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 11:24:36 +0100 [thread overview]
Message-ID: <PAXPR06MB776061C5B2EBE4756D05E7B7C6309@PAXPR06MB7760.eurprd06.prod.outlook.com> (raw)
In-Reply-To: <87leyiw6uu.fsf@yahoo.com>
Thanks for clarifying, Po Lu!
One final question. Does then Emacs assert ownership of the selection
also when it reads it (C-y) and not only when it sets it (C-k), as I
assumed in my last email? Because otherwise I think my point still
holds, and I didn't see any use of gui-backend-set-selection inside
gui-selection-value (and I could not test it since I'm running Emacs
27).
But never mind, I'll leave it here since I stole too much of your time
already. Just one last minor thing: there is a very minor typo in the
comments on select.el in case you want to fix it (or at least it is in
the github mirror which seems to be up to date). It says:
;; The functionality here is divided in two parts:
;; - Low-level: gui-get-selection, gui-set-selection, gui-selection-owner-p,
;; gui-selection-exists-p are the backend-dependent functions meant to access
;; various kinds of selections (CLIPBOARD, PRIMARY, SECONDARY).
But the last two functions are actually gui-backend-selection-owner-p and
gui-backend-selection-exists-p, the others do not exist. For the first
two, they exist for both prefixes gui- and gui-backend-, the second
being lower level.
Regards,
Ignacio
Po Lu <luangruo@yahoo.com> writes:
> 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.
next prev parent reply other threads:[~2022-02-11 10:24 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 9:13 bug#53894: 27.2; Clipboard copy -> C-y -> M-y -> Same clipboard copy does not push to kill ring Ignacio Casso
2022-02-09 11:44 ` Lars Ingebrigtsen
2022-02-09 12:52 ` Ignacio Casso
2022-02-09 20:21 ` Lars Ingebrigtsen
2022-02-10 1:56 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-10 6:20 ` Eli Zaretskii
2022-02-10 6:31 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-10 6:42 ` Lars Ingebrigtsen
2022-02-10 6:48 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-10 8:37 ` Lars Ingebrigtsen
2022-02-10 10:03 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-10 6:39 ` Lars Ingebrigtsen
2022-02-10 8:06 ` Eli Zaretskii
2022-02-10 8:43 ` Lars Ingebrigtsen
2022-02-10 10:04 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-10 11:37 ` Lars Ingebrigtsen
2022-02-10 12:08 ` Eli Zaretskii
2022-02-10 12:14 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-10 12:29 ` Eli Zaretskii
2022-02-10 12:38 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-10 12:49 ` Lars Ingebrigtsen
2022-02-10 13:20 ` Ignacio Casso
2022-02-11 1:05 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-11 10:24 ` Ignacio Casso [this message]
2022-02-11 11:16 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-11 11:28 ` Ignacio Casso
2022-02-11 12:38 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-11 12:42 ` Ignacio Casso
2022-02-11 12:58 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-12 2:28 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-27 18:57 ` Ignacio Casso
2022-02-28 1:01 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-28 12:12 ` Ignacio Casso
2022-02-28 13:35 ` Eli Zaretskii
2022-02-28 14:22 ` Ignacio Casso
2022-02-28 13:48 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-28 14:35 ` Ignacio Casso
[not found] ` <87wnhfoy5h.fsf@hotmail.com>
2022-02-28 16:10 ` Ignacio Casso
2022-03-01 0:42 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-01 7:51 ` Ignacio Casso
2022-03-01 13:19 ` Eli Zaretskii
2022-03-01 15:29 ` Ignacio Casso
2022-03-02 0:51 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-02 7:44 ` Ignacio Casso
2022-03-02 7:59 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-02 8:37 ` Ignacio Casso
2022-03-02 10:03 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-09 7:41 ` Ignacio Casso
2022-03-09 13:47 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-24 19:59 ` Ignacio Casso
2022-03-25 6:25 ` Eli Zaretskii
2022-03-29 12:01 ` Ignacio Casso
2022-03-29 13:00 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-01 10:15 ` Ignacio Casso
2022-04-01 10:59 ` Eli Zaretskii
2022-04-01 11:23 ` Ignacio Casso
2022-04-01 12:04 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-01 12:15 ` Eli Zaretskii
2022-04-01 12:57 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-01 12:10 ` Eli Zaretskii
2022-03-01 15:19 ` Lars Ingebrigtsen
[not found] ` <871qznc4qg.fsf@hotmail.com>
2022-02-28 16:56 ` Ignacio Casso
[not found] ` <87v8xl376s.fsf@hotmail.com>
2022-02-11 12:48 ` Ignacio Casso
[not found] ` <87pmnurelg.fsf@hotmail.com>
2022-02-10 14:29 ` Ignacio Casso
2022-02-11 6:15 ` Lars Ingebrigtsen
2022-02-11 8:16 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PAXPR06MB776061C5B2EBE4756D05E7B7C6309@PAXPR06MB7760.eurprd06.prod.outlook.com \
--to=ignaciocasso@hotmail.com \
--cc=53894@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=luangruo@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.