From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ignacio Casso 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 11:24:36 +0100 Message-ID: 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> <87leyiw6uu.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40852"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.6.10; emacs 27.2 Cc: Lars Ingebrigtsen , 53894@debbugs.gnu.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 11 11:49:18 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 1nITUK-000APr-Bp for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 11 Feb 2022 11:49:16 +0100 Original-Received: from localhost ([::1]:51468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nITUI-0000Lg-VQ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 11 Feb 2022 05:49:14 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nITU6-0000LW-Q5 for bug-gnu-emacs@gnu.org; Fri, 11 Feb 2022 05:49:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36287) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nITU6-0003mZ-GB for bug-gnu-emacs@gnu.org; Fri, 11 Feb 2022 05:49:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nITU6-00057n-BL for bug-gnu-emacs@gnu.org; Fri, 11 Feb 2022 05:49:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ignacio Casso Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 11 Feb 2022 10:49: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.164457653919690 (code B ref 53894); Fri, 11 Feb 2022 10:49:02 +0000 Original-Received: (at 53894) by debbugs.gnu.org; 11 Feb 2022 10:48:59 +0000 Original-Received: from localhost ([127.0.0.1]:58417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nITTv-00057L-MJ for submit@debbugs.gnu.org; Fri, 11 Feb 2022 05:48:59 -0500 Original-Received: from mail-am6eur05olkn2080.outbound.protection.outlook.com ([40.92.91.80]:58465 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nITTt-000578-4i for 53894@debbugs.gnu.org; Fri, 11 Feb 2022 05:48:50 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jcf8SOAmfoftISyNqIPqaclCrxUJ4rUU82JmGi6/VkkP14iFvEyruNGjjFdNuUgGbOXWajzlmWKpHVpCCKY8oP8Qhq3gyt/SC9bN7Er58rsEGLc09T/ZhyLWM7Avbn0bR2CJFc7/n1sYlZye2oaUXY9d1FmOqafKVH8fXPANQXixmHi0mNb4ZulqKVfkPDW4gLuZUJH6SdfdMuFNaOwUE7vcN2VAqcjFIXEPhCCNtf3PD5fVaVxl5XcAmFFpZdniUeVJWfH/cE6hdgscvEUXapwRP+/42lraEdYONI9tWWSyp/0dPJlCKJ4xAwjkDPHZRERbKc+uUFtfo7ZD6O/hsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=a/jPMoDJ3Tnx71nYq1xJqmG8VZEx9X8qukwsa7s48tg=; b=QymFDdmYDT7PotzLzaTEVtXiNXZzb+1cxwhRL8hoZEaWYHBjnvcm3HnNR8x2GcxF1Mplm9x6Yp2ew+E6/m7cQMFdqAuZmwk6m9xCOWxUzBgs/b4psKOoIqtcDhQFbL4XEoZd6GKrgbWUDyMtDCP0+QcUQSHC/IyW/FHQqR5DTTj+72QycVT8xgHNtU989qpwthYZu5JZV90BMLXgof7hGbmfLWS96oRBsyGI/vTfFx/CwOIxA3bNI8eYJcdY2D1C3/kuUHWrdA+BBqNPnALbVIblB+9Se/G822vuux7jjlF1TRmz9mZIc8ouFmh5xNcuhCIsD+JpxDhpWBrL4Cg6/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a/jPMoDJ3Tnx71nYq1xJqmG8VZEx9X8qukwsa7s48tg=; b=OUbPl/anf2EqiNUkYhShD4Ra6AUb8hxcs8chJLCfkVRpCJNVTeiZ22fxUCEeNNasSpfBoYUTGkNEi3tsOsf5rejuZNQtDyo0tMhF2HEypTuKjXeWdnU8Em0nGhvlMJhz3bq0f6loXnhzr3NPSF+9/tkuREuqF8P6l89/PEW/F0qMMBYqZ9vWXTfFmk8nzJqhZHIgic/8PmwARz6Qau05t+X0JbNzCqYHz5rKDdrnoMe2IQS1iBVLSU30wRgtG5c+0LV3ywo3zb7qFSOO/gE9Zr6RMn4b5LCFVClWQuMm7AcDAd4Z0oOUELpv8TmfMYHHkpdt2+iKzGBHD5cp2YAkKA== Original-Received: from PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) by DB7PR06MB4744.eurprd06.prod.outlook.com (2603:10a6:10:5c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Fri, 11 Feb 2022 10:48:42 +0000 Original-Received: from PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::50de:9162:7856:2782]) by PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::50de:9162:7856:2782%6]) with mapi id 15.20.4975.015; Fri, 11 Feb 2022 10:48:42 +0000 In-reply-to: <87leyiw6uu.fsf@yahoo.com> X-TMN: [Q0lgCIOjiOj7jAEdV37mesnBDVsSOpwr] X-ClientProxiedBy: MR2P264CA0050.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:31::14) To PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) X-Microsoft-Original-Message-ID: <874k554r1z.fsf@hotmail.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 989bc4e5-3eb2-4714-c81b-08d9ed4c11aa X-MS-TrafficTypeDiagnostic: DB7PR06MB4744:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-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HXvEQu0l0bYqAOE6bIUlbxOeeX/1zTpXv5EiMIcX+B8tY8bERWR83FJBwHX1cc2LPH7bOEQU/mNIrzU1x9Sabcol1s2ngyOPhOBKi9qXQ+miatLsj0U5wO7y0e80r4WZVoYm5aYreO7vmpIBEzbkcBBS2Gazx68El9GTLHyxRDzKrcIrWyTMjIAyIC1bZlwadQoU1RqgLjZjryrGyrtKBDTjIuOhoYSkQNmW4MTH7NqEPH5deHQYC0qwU3fwBxP6YUinGkpQl5EXp7vEWqk2WKAmG89bsvLuNHtDvghpV14Yk5s/5iPhxE1V3f7t2H0ituzjhp7WDXGwp07tixa 6NPoV8Tncnx0knRmkYfgT7rcgf4q9e9K6xdjyUPDk9iRbHcHjpK+gjhRutREbv2e3ybKNOmg0CrvQaXs8KarGpMZKrBdk1edHk X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6e454.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 989bc4e5-3eb2-4714-c81b-08d9ed4c11aa X-MS-Exchange-CrossTenant-AuthSource: PAXPR06MB7760.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2022 10:48:42.3413 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR06MB4744 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:226661 Archived-At: 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 writes: > 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.