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, 01 Apr 2022 12:15:58 +0200 Message-ID: References: <87pmnttw78.fsf@yahoo.com> <87leyhtv9q.fsf@yahoo.com> <87wni0str6.fsf@yahoo.com> <87h78j6bz0.fsf@yahoo.com> <87czj73xw8.fsf@yahoo.com> <87wnhfoy5h.fsf@hotmail.com> <87sfs233lx.fsf@yahoo.com> <83fso1lsjf.fsf@gnu.org> <871qzlw50r.fsf@yahoo.com> <87sfs0u6n2.fsf@yahoo.com> <87a6d829rx.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27243"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.6.10; emacs 29.0.50 Cc: 53894@debbugs.gnu.org, larsi@gnus.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 01 12:30:11 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 1naEXi-0006pk-0q for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Apr 2022 12:30:10 +0200 Original-Received: from localhost ([::1]:36852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1naEXg-0006jE-QP for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Apr 2022 06:30:08 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naEWi-0006gy-2w for bug-gnu-emacs@gnu.org; Fri, 01 Apr 2022 06:29:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47053) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1naEWc-0001Fw-Ly for bug-gnu-emacs@gnu.org; Fri, 01 Apr 2022 06:29:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1naEWc-0004aP-EI for bug-gnu-emacs@gnu.org; Fri, 01 Apr 2022 06:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ignacio Casso Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Apr 2022 10:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53894 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 53894-submit@debbugs.gnu.org id=B53894.164880892117582 (code B ref 53894); Fri, 01 Apr 2022 10:29:02 +0000 Original-Received: (at 53894) by debbugs.gnu.org; 1 Apr 2022 10:28:41 +0000 Original-Received: from localhost ([127.0.0.1]:40950 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naEWH-0004ZT-2u for submit@debbugs.gnu.org; Fri, 01 Apr 2022 06:28:41 -0400 Original-Received: from mail-oln040092065023.outbound.protection.outlook.com ([40.92.65.23]:13890 helo=EUR01-HE1-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naEWC-0004Yx-Oy for 53894@debbugs.gnu.org; Fri, 01 Apr 2022 06:28:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fv/TZWwR0Qjr/J7Nnc+/hx5fSCg/cxBGZSO3TGSBYR2R1m3IIIh/W2LM7z6slsRTjJCY8oUJNuSzwmO2cOcf23b91dqDJ1sudN1aTRNbJ/qAkNhv2WI5gtIBMkucqhnA7VRel8TpPjwH02i8N3cVc+11AeDE4rtBIweaim6ms7Vw9CzgMx2i0ju8jn/hux0RgSIoJrrXgH16W30afgiZkHGXhg2BglPAV4D4thG/HO9ehb3OIGx0AVarAcqaS2dwGz4ngZ+ruFEtOu33VvkUTGdVSY9EBO8LLXunrfbK4weE6zEEF1ulDT4JAXY79mxft4CI2sgG5OCAqYVhKPBQyA== 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=h29UlHckLATtRVrePr5aQ/Nfh9QLvplrld//F1NNW5c=; b=Fa1+/tutLpJzAom8KKGgou5nv29JDrMHiNhuWGThXRjACwUHyhcb/aOfoxB04iuPt9ADUb9kNvKCAKRYZKr0EmqbucxrF4BeHJRPDkiYBNBxq8a/PrnxRjyfsFX+ZC71RG9SeG8tacqGyVIIynMeiijEcEN9vsC2VyGejMZECbWrtyc0RSUxnVS65AbUGTsxccdyrbYs/VAD1sV+CJHNW768bwh+Yp2wKup5KaImGOjhYNiQaW9wkzTqpTup4tz4FnbE/l2rLv7CSNUQ6bxJXEmdcq6AW14Rvmi2hXtuzk/mlmb20SPjZLaifOYAcaJehaJu3o19InMlSUkGKIKOiw== 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=h29UlHckLATtRVrePr5aQ/Nfh9QLvplrld//F1NNW5c=; b=rv9sTvulNOF5F7yCGCsrwWjFWiCOutBvQZp14VVyOB8vDxur+SK7dArqWeCgOwCS/JNsKTylp6PlGlk2KVlxhuGe6xeK62gvIHNURaJ6LxCRolGfos1Q3xEhjkNAfAdMGxOi2j+ob/3YDOXUXSP6FiTrhn/FyygAIq4rA/RUnYOrhpybzg9qlWZ1ENk9l3LZhXqmggV+Wc0hLuO0GqrOIU7ZcoJqEuwjDeh35T8/bmhhwDPUu+AHWfu/e52DYuGl+v3aVlcNKPL+F2gFv6v6jI3yqzTCKbqcoTnT9REQ9rshKBeJsnZreVcIYUMQh+NXRIU7RaXnuzc5uSX2nkWd0g== Original-Received: from PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) by AM0PR06MB6516.eurprd06.prod.outlook.com (2603:10a6:208:196::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.19; Fri, 1 Apr 2022 10:28:29 +0000 Original-Received: from PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::e05a:8d81:8648:b10f]) by PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::e05a:8d81:8648:b10f%8]) with mapi id 15.20.5123.025; Fri, 1 Apr 2022 10:28:29 +0000 In-reply-to: <87a6d829rx.fsf@yahoo.com> X-TMN: [iNQ+lCABbJrWDapA1aAyiyC0D2eg2r+Y] X-ClientProxiedBy: MR2P264CA0167.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:1::30) To PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) X-Microsoft-Original-Message-ID: <877d89rtbr.fsf@hotmail.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c909be38-7008-4226-a3cd-08da13ca5d01 X-MS-TrafficTypeDiagnostic: AM0PR06MB6516:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I0AsMxvd5ESKTmcF0tdhg84WG0xHRnvpXF9/oh7m2iF1youvhAPXXO6Lw/sX3kYSbtSzq5iIM80IA8HiBGBYp3iQcyEtToyBJ8/EvyP/MovIm+wHuZ0BOz6B6id4RJjsOaEmD7m0R3jL0CEs1GiXJC+GthWHMqV9hwYsGfzD308SlREs6mp0VRaxzH1q6XO+d2zpoRCxji+Ht7BXvz8OTiYNjWqiUJrcf/bCXov+nZquDd7q6SiGzKJQiGJmXTVcjzzMjEUykSCwfmCr1uYz+8nqyuzpsucJllrUgDKLcsNLn+mdwik1dQ3ryYaLW6er0Pssjo8SXsGApMbfvi6HeHDrBAj7YDoHtv863+bdZLIRY4MKRXszNg/mMvHInROv7Oc04xi0DnojKY2rykHbMNifeXezCyCQbEJj/0oLONJu/aE8MoQ8VUVBQeHOw2FRWmCTy+jDMkoNexEJfipRVKU9L6qrRpm+hTfUIkCYaOenF2T9ZOK+8st1VrfjYJ57BMYXDk+YlmfcL2iZOk+0pfb2r7RLuUG1aqxnuXaJngP96ysoL7yMfSVUyKyraGTLq/LsZW3r9pfe7t4UqHFEwA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5jBv67u3gnD7/wprQW+go23IRBZMvgG1MafhHB/drw/jYDUqtz1UrMvaRiq3YqGG5I8cvOSSiUjRh8CFqBWRWXjPpBmnP4Sv4USuYwrUBWZNIS+Sbm/oIqbnfIaHNlcwmZLqCwPewLPN+cBgJ1z+F24HovR02TcN6e5DAJ+vtYSGG/CDN/7lgXh204OMxuiifUr2k0iMaocXsKXITDCmvVHUV7xspYmtqolmdok0mxktYiTjMsixxAUm9Nmx9ezYIHtYadpKTvzg4bPBEZAEx3OGYgXOe8Li4GlYAv2tDR5lShZ1JPTfDK20FmPU3SFsnXzbm6sPQ6D9HzhrWFWbkLAw/NdffXJctCSPHDCyIYpV+/Ke9xh8YoC6F/T+jKhAt28KofdYMTctOvcX6xCFbdRUhr7gSAy+oypLeiVyf1n41zZDX7VR5MuNqkC8Bpj0UC08rh+/ql3gxuI4zfeIWWtVdtSU2KuqwYx5ghPwX/GZt9Tuc3v/aryreMIbYACgeVtMBsjvX/zRvtkPKLGvQn2Dr5UNpTIKK5UV+nKxembOsZxJkoltDhE6LLSvQYmn0Dz1guDHhqF20U+my7eWKD1SbsmQvlP8UJnRwYzTgT5Dag0U5k0eUnlL0tJIXr0gim/M6TDWTsDwLdmgchjbI5z5HYXyckFODV34LdlK2G/P2bvv0i8JkHG24qrgGIAYsjZWDnQsZsgtlsj82fy3XjgtR9IE2GgHClfkYPuiV8fx1O96m0a6ovtiH8 D2a8kkBHVh3K+h5r6R06hslajc9YZ++zxa+eb0Jj4Eed1ooHEt5qYxHWB6uMmS2aADJ1Lh7OvWoLx+OOADutw9uTjcd/Tj+rkD X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6e454.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: c909be38-7008-4226-a3cd-08da13ca5d01 X-MS-Exchange-CrossTenant-AuthSource: PAXPR06MB7760.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2022 10:28:29.8567 (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: AM0PR06MB6516 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:229211 Archived-At: --=-=-= Content-Type: text/plain Po Lu writes: > Ignacio Casso writes: > >> Ok, here is the final patch, and a suggested commit message. I've >> initiated the paperwork for the copyright assignment, I will let you >> know when it is done. > > Thanks. A last-minute comment: > > > These checks should use `gui-backend-get-selection' to find the > selection timestamp, not the public function. Done. > Also, the doc strings of the new functions should explain the meaning > of the argument `text'. Done. > and the first line of each doc string should be a complete sentence > not more than 70 characters wide, terminated by a period. Done. > Perhaps the entire comment could be reworded instead of adding > an edit to the end. There should also be two spaces between > punctuation and any further text, like this: "wanted. EDIT: We > do...". Done. I have also introduced two very minor changes with respect to the last patch: - In my comment in pc-win.el: EDIT -> NOTE - In select.el, inside gui-selection-value: simplified `prog1' forms Here is the new patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Better-check-for-when-clipboard-or-primary-selection.patch Content-Description: Patch for bug#53894 >From 9630ca85cf54c5b4d1867948792c65d3f242101c Mon Sep 17 00:00:00 2001 From: Ignacio Date: Sun, 13 Mar 2022 21:05:18 +0100 Subject: [PATCH] Better check for when clipboard or primary selection have changed Previously it was done by just comparing new and old selection text, now we use also selection timestamps for systems that support it (only enabled in X for now). This fixes bug#53894. lisp/select.el: new variables gui--last-selection-timestamp-clipboard and gui--last-selection-timestamp-primary. New functions gui--set-last-clipboard-selection, gui--set-last-primary-selection, gui--clipboard-selection-unchanged-p and gui--primary-selection-unchanged-p. --- lisp/menu-bar.el | 3 +- lisp/select.el | 108 +++++++++++++++++++++++++++++++------------- lisp/term/pc-win.el | 8 ++++ 3 files changed, 87 insertions(+), 32 deletions(-) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index ab64928fe7..d8c8c760f7 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -606,7 +606,8 @@ clipboard-yank "Insert the clipboard contents, or the last stretch of killed text." (interactive "*") (let ((select-enable-clipboard t) - ;; Ensure that we defeat the DWIM login in `gui-selection-value'. + ;; Ensure that we defeat the DWIM logic in `gui-selection-value' + ;; (i.e., that gui--clipboard-selection-unchanged-p returns nil). (gui--last-selected-text-clipboard nil)) (yank))) diff --git a/lisp/select.el b/lisp/select.el index c352a48261..9db0a7cf84 100644 --- a/lisp/select.el +++ b/lisp/select.el @@ -25,9 +25,10 @@ ;; Based partially on earlier release by Lucid. ;; 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). +;; - Low-level: gui-backend-get-selection, gui-backend-set-selection, +;; gui-backend-selection-owner-p, gui-backend-selection-exists-p are +;; the backend-dependent functions meant to access various kinds of +;; selections (CLIPBOARD, PRIMARY, SECONDARY). ;; - Higher-level: gui-select-text and gui-selection-value go together to ;; access the general notion of "GUI selection" for interoperation with other ;; applications. This can use either the clipboard or the primary selection, @@ -108,9 +109,10 @@ select-enable-primary :group 'killing :version "25.1") -;; We keep track of the last text selected here, so we can check the -;; current selection against it, and avoid passing back our own text -;; from gui-selection-value. We track both +;; We keep track of the last selection here, so we can check the +;; current selection against it, and avoid passing back with +;; gui-selection-value the same text we previously killed or +;; yanked. We track both ;; separately in case another X application only sets one of them ;; we aren't fooled by the PRIMARY or CLIPBOARD selection staying the same. @@ -119,22 +121,68 @@ gui--last-selected-text-clipboard (defvar gui--last-selected-text-primary nil "The value of the PRIMARY selection last seen.") +(defvar gui--last-selection-timestamp-clipboard nil + "The timestamp of the CLIPBOARD selection last seen.") +(defvar gui--last-selection-timestamp-primary nil + "The timestamp of the PRIMARY selection last seen.") + +(defun gui--set-last-clipboard-selection (text) + "Save last clipboard selection. +Save the selected text, passed as argument, and for window +systems that support it, save the selection timestamp too." + (setq gui--last-selected-text-clipboard text) + (when (memq window-system '(x)) + (setq gui--last-selection-timestamp-clipboard + (gui-backend-get-selection 'CLIPBOARD 'TIMESTAMP)))) + +(defun gui--set-last-primary-selection (text) + "Save last primary selection. +Save the selected text, passed as argument, and for window +systems that support it, save the selection timestamp too." + (setq gui--last-selected-text-primary text) + (when (memq window-system '(x)) + (setq gui--last-selection-timestamp-primary + (gui-backend-get-selection 'PRIMARY 'TIMESTAMP)))) + +(defun gui--clipboard-selection-unchanged-p (text) + "Check whether the clipboard selection has changed. +Compare the selection text, passed as argument, with the text +from the last saved selection. For window systems that support +it, compare the selection timestamp too." + (and + (equal text gui--last-selected-text-clipboard) + (or (not (memq window-system '(x))) + (eq gui--last-selection-timestamp-clipboard + (gui-backend-get-selection 'CLIPBOARD 'TIMESTAMP))))) + +(defun gui--primary-selection-unchanged-p (text) + "Check whether the primary selection has changed. +Compare the selection text, passed as argument, with the text +from the last saved selection. For window systems that support +it, compare the selection timestamp too." + (and + (equal text gui--last-selected-text-primary) + (or (not (memq window-system '(x))) + (eq gui--last-selection-timestamp-primary + (gui-backend-get-selection 'PRIMARY 'TIMESTAMP))))) + + (defun gui-select-text (text) "Select TEXT, a string, according to the window system. -if `select-enable-clipboard' is non-nil, copy TEXT to the system's clipboard. +If `select-enable-clipboard' is non-nil, copy TEXT to the system's clipboard. If `select-enable-primary' is non-nil, put TEXT in the primary selection. MS-Windows does not have a \"primary\" selection." (when select-enable-primary (gui-set-selection 'PRIMARY text) - (setq gui--last-selected-text-primary text)) + (gui--set-last-primary-selection text)) (when select-enable-clipboard ;; When cutting, the selection is cleared and PRIMARY ;; set to the empty string. Prevent that, PRIMARY ;; should not be reset by cut (Bug#16382). (setq saved-region-selection text) (gui-set-selection 'CLIPBOARD text) - (setq gui--last-selected-text-clipboard text))) + (gui--set-last-clipboard-selection text))) (define-obsolete-function-alias 'x-select-text 'gui-select-text "25.1") (defcustom x-select-request-type nil @@ -175,6 +223,7 @@ gui--selection-value-internal ;; some other window systems. (memq window-system '(x haiku)) (eq type 'CLIPBOARD) + ;; Should we unify this with gui--clipboard-selection-unchanged-p? (gui-backend-selection-owner-p type)) (let ((request-type (if (memq window-system '(x pgtk haiku)) (or x-select-request-type @@ -197,19 +246,17 @@ gui-selection-value (let ((text (gui--selection-value-internal 'CLIPBOARD))) (when (string= text "") (setq text nil)) - ;; When `select-enable-clipboard' is non-nil, - ;; killing/copying text (with, say, `C-w') will push the - ;; text to the clipboard (and store it in - ;; `gui--last-selected-text-clipboard'). We check - ;; whether the text on the clipboard is identical to this - ;; text, and if so, we report that the clipboard is - ;; empty. See (bug#27442) for further discussion about - ;; this DWIM action, and possible ways to make this check - ;; less fragile, if so desired. - (prog1 - (unless (equal text gui--last-selected-text-clipboard) - text) - (setq gui--last-selected-text-clipboard text))))) + ;; Check the CLIPBOARD selection for 'newness', i.e., + ;; whether it is different from the last time we did a + ;; yank operation or whether it was set by Emacs itself + ;; with a kill operation, since in both cases the text + ;; will already be in the kill ring. See (bug#27442) and + ;; (bug#53894) for further discussion about this DWIM + ;; action, and possible ways to make this check less + ;; fragile, if so desired. + (unless (gui--clipboard-selection-unchanged-p text) + (gui--set-last-clipboard-selection text) + text)))) (primary-text (when select-enable-primary (let ((text (gui--selection-value-internal 'PRIMARY))) @@ -217,10 +264,9 @@ gui-selection-value ;; Check the PRIMARY selection for 'newness', is it different ;; from what we remembered them to be last time we did a ;; cut/paste operation. - (prog1 - (unless (equal text gui--last-selected-text-primary) - text) - (setq gui--last-selected-text-primary text)))))) + (unless (gui--primary-selection-unchanged-p text) + (gui--set-last-primary-selection text) + text))))) ;; As we have done one selection, clear this now. (setq next-selection-coding-system nil) @@ -235,11 +281,11 @@ gui-selection-value ;; something like the following has happened since the last time ;; we looked at the selections: Application X set all the ;; selections, then Application Y set only one of them. - ;; In this case since we don't have - ;; timestamps there is no way to know what the 'correct' value to - ;; return is. The nice thing to do would be to tell the user we - ;; saw multiple possible selections and ask the user which was the - ;; one they wanted. + ;; In this case, for systems that support selection timestamps, we + ;; could return the newer. For systems that don't, there is no + ;; way to know what the 'correct' value to return is. The nice + ;; thing to do would be to tell the user we saw multiple possible + ;; selections and ask the user which was the one they wanted. (or clip-text primary-text) )) diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el index 327d51f275..514267a52d 100644 --- a/lisp/term/pc-win.el +++ b/lisp/term/pc-win.el @@ -246,6 +246,14 @@ w16-selection-owner-p ;; if it does not exist, or exists and compares ;; equal with the last text we've put into the ;; Windows clipboard. + ;; NOTE: that variable is actually the last text any program + ;; (not just Emacs) has put into the windows clipboard (up + ;; until the last time Emacs read or set the clipboard), so + ;; it's not suitable for checking actual selection + ;; ownership. This should not result in a bug for the current + ;; uses of gui-backend-selection-owner however, since they + ;; don't actually care about selection ownership, but about + ;; the selected text having changed. (cond ((not text) t) ((equal text gui--last-selected-text-clipboard) text) -- 2.25.1 --=-=-=--