From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs 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 Message-ID: <87leyiw6uu.fsf@yahoo.com> References: <87mtj0l0wp.fsf@gnus.org> <87r18bg59w.fsf@gnus.org> <87wni3zdqf.fsf@yahoo.com> <838rujutsj.fsf@gnu.org> <87a6ezfcnc.fsf@gnus.org> <83zgmztabd.fsf@gnu.org> <8735kr9kmp.fsf@gnus.org> <83pmnuudo6.fsf@gnu.org> <87ee4ayl3n.fsf@yahoo.com> <83k0e2ucq7.fsf@gnu.org> <877da2yjze.fsf@yahoo.com> <87iltm7upm.fsf@gnus.org> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24017"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) Cc: Lars Ingebrigtsen , 53894@debbugs.gnu.org, Eli Zaretskii To: Ignacio Casso Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 11 02:06:15 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nIKO7-00069x-2c for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 11 Feb 2022 02:06:15 +0100 Original-Received: from localhost ([::1]:60698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nIKO6-0001eP-4U for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 10 Feb 2022 20:06:14 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nIKNu-0001cI-Ou for bug-gnu-emacs@gnu.org; Thu, 10 Feb 2022 20:06:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35560) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nIKNu-0001Bu-Ek for bug-gnu-emacs@gnu.org; Thu, 10 Feb 2022 20:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nIKNu-0004YB-7j for bug-gnu-emacs@gnu.org; Thu, 10 Feb 2022 20:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Feb 2022 01:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53894 X-GNU-PR-Package: emacs Original-Received: via spool by 53894-submit@debbugs.gnu.org id=B53894.164454153317451 (code B ref 53894); Fri, 11 Feb 2022 01:06:02 +0000 Original-Received: (at 53894) by debbugs.gnu.org; 11 Feb 2022 01:05:33 +0000 Original-Received: from localhost ([127.0.0.1]:57690 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nIKNR-0004XM-HP for submit@debbugs.gnu.org; Thu, 10 Feb 2022 20:05:33 -0500 Original-Received: from sonic306-21.consmr.mail.gq1.yahoo.com ([98.137.68.84]:36975) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nIKNQ-0004X4-As for 53894@debbugs.gnu.org; Thu, 10 Feb 2022 20:05:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1644541525; bh=tZBrbHDmkcw8CPiAtWPXO/mtomeUUaXb6+KHy6v1FvI=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=uMwHFmO9EI9cK1ESX5DDSs19S7qhTCHuFY9APOEASOqul61aGa1JCEZx3euLv62dpRjVD77C3RacPqWvFma5Ma5q5d3ck61LiTifdOb2K+1vA4pHj1Mb/XVxmmB+m7yP6lugrrxk/Em7guDZFR9mAkIIZWzcEL5IWM0+x6PqMw1jhDdY03nUf/Z6iw3A8oHUbjPqC3m77Ks5fyycVzfu/TTWsnb5ZaAAClAQvMz+Z/FPUmaPi0qykdABkgEOHMcxj3kLJd22odstyvyn9XkVYgSeP9EKtG1LGhFHdh7p/jlQFxvy8Fd+832mfQbWTBNihG7YcvEjL7f2xLfHds+vmA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1644541525; bh=OujXTl0/9x8J2DAvZj2KyhMyN77pSqAwNuIxaYR/Wm0=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=JOwO0ySJCszljtgUeoX4SzyUoou5n/dyXlN1vcgfJ9KYq8KmtP2zZlKn4JFP7bA6npYglRG1rKFOUEyIQ+kMV2OMP8M1QWPrVz3VeUlfzn29+L3B7HVp66F4oYZ5rIUaTJbqqUxazywfN0b2OA8rZZW3qZacOgAae6YCA8LBk4i8KC6amY6xi3BvVbkc2Bm5eIs5RzJOPPA5ddco+Qlav/TFHU0NHuK7/gedad9Ot66XQ+d7hiPoZd8clt/tPsEZ1bQLjjeua8rGfbE8Mnq04WVL9pd6iuAvjJgds3uWGWmyyzEsbc2MAjKRowckGSSUDbYjSHXhBOZlyv9g0ObPpA== X-YMail-OSG: 0CEIYK0VM1k_TU8O..KOvX4QACjHTBZiV0AtNW8hKmHeuRcTfu.n15l3CnTqlhm _m9YV4yT4Pveg05NFg8HGRUQ0ABpxguwSxl2K2spOfiZZVEajY7FAD4Dpvmhmy4XNyDXuL4S9RHE E5w6J.7UEWmQ7kzIBm.WAqhMJ_5b.f1l3taPtaHETWMfGSCZuc.9GKQr5t8XSYHk2gx3_h3aA_sw 4rqPXQpEcJQcgznvfReqz6GLuof7IWvTUf6ceP6EPVJfLS8hC_ejlGUr_Ooq1ux.1EztV0XBh16V UOtt4uAl.NtVgwpO7YjCTJACF.1xPYg_aPkE_3Q2BM0Ab8LRroGaekQonSOOxtpMb50DB5VdZ4T2 sY.DvXJohZShUGlvrJhTDtONr19TDcDHTz8Az_fkP_4ft0BZt5yfygtkdZx02up4ovx0f9UWAx8E hC6vf_zvOFDXYG2N6Xw5pvKkxgc3rj6EitQ3x41VJbcARBUVhbElGDryJr7KNOV9GxFlDjn3pxvq nwV7Q4Yq98ap2G_qSQ3wwtlxmpdBcuh0r23mTM7zVgclf7MShIpQsH3uVSRiByrY63dzjCJxWKEp xQt.6rl8EOr6GxTm1ffb7hxQq.y6lHJvuTY7dbmtJHORQQu7xoeLvu0wb72t0pV4QYRU4vmrixvT gdtpYCw9hf3W9d0mIG3eWpcjH0uzsdX.2lSlzwx1A9YzJkdyH..WG2vVXfF2joiCxj22onmJaCW9 CMpml6H.aA_ECwvKVxGnRK7v7DSADJjas.TUarncBjKGT7RWl.ffzjksJbPyP5ywVsNKjK4rPryh 4ebF3nuZt8CnXr0DwF3JVj6X9Zf4WhgKnhBamtPi6V X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.gq1.yahoo.com with HTTP; Fri, 11 Feb 2022 01:05:25 +0000 Original-Received: by kubenode504.mail-prod1.omega.sg3.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 668dfd0034513a8ec1f7bf085b7dc87e; Fri, 11 Feb 2022 01:05:17 +0000 (UTC) In-Reply-To: (Ignacio Casso's message of "Thu, 10 Feb 2022 14:20:15 +0100") X-Mailer: WebService/1.1.19724 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:226636 Archived-At: Ignacio Casso 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.