From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#55883: [PATCH] Update X Primary Selection with active regions Date: Tue, 14 Jun 2022 15:15:06 +0300 Message-ID: <837d5jtp9x.fsf@gnu.org> References: <834k0t104u.fsf@gnu.org> <8335gbzled.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27851"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55883@debbugs.gnu.org To: Duncan Findlay Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 14 14:20:00 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 1o15WZ-00072F-Pf for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Jun 2022 14:19:59 +0200 Original-Received: from localhost ([::1]:50916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o15WY-0002tB-NN for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Jun 2022 08:19:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44992) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o15Sk-0006IP-US for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 08:16:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39417) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o15Sk-0007g3-HT for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 08:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o15Sk-0000Qn-DC for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 08:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 Jun 2022 12:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55883 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 55883-submit@debbugs.gnu.org id=B55883.16552089311614 (code B ref 55883); Tue, 14 Jun 2022 12:16:02 +0000 Original-Received: (at 55883) by debbugs.gnu.org; 14 Jun 2022 12:15:31 +0000 Original-Received: from localhost ([127.0.0.1]:33314 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o15SF-0000Px-FC for submit@debbugs.gnu.org; Tue, 14 Jun 2022 08:15:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59770) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o15S9-0000Ph-FF for 55883@debbugs.gnu.org; Tue, 14 Jun 2022 08:15:29 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34296) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o15S4-0007Ud-7h; Tue, 14 Jun 2022 08:15:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=A5+gVFaitLx5ntclcqPfd7f2uZgvOmZ6d7g93nd0h8M=; b=rMow5pfDCgn4 Dt9ROJoa04mI00iitpqS5HAOdMSQ2Wkqh+LoG6iPM+nM9imQZT/W5tGK2sdrj+zZ8feY/6DDVeZUv r44g5UHx8yLmpdNPsJ8nucTs7yQ/9YNtyMfRzFaX60k9AXuhS3Jo8Y8oDCFCuYCN6JRug0MT7xgCu a5xMZjHQRo7UgKuozAHlLSv0uT5dV9RS3cECr38N5zNWSCuAF60i7GSUXAmH4c1uZu7l7zSLYcRcZ wHTTydZm18zwh+1VBLhIhnHBt7jg79uU0v6FUs0FpezgznutELGv0n4edlZbJ8l+JqjJe5apQ2dPc u+H7Z+oGXCrbSGhyiuGzMw==; Original-Received: from [87.69.77.57] (port=2332 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o15S0-0005Ha-Qm; Tue, 14 Jun 2022 08:15:20 -0400 In-Reply-To: (message from Duncan Findlay on Mon, 13 Jun 2022 23:36:13 -0700) 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:234486 Archived-At: > From: Duncan Findlay > Date: Mon, 13 Jun 2022 23:36:13 -0700 > Cc: 55883@debbugs.gnu.org > > > > --- a/lisp/frame.el > > > +++ b/lisp/frame.el > > > @@ -2164,6 +2164,8 @@ display-selections-p > > > (not (null dos-windows-version)))) > > > ((memq frame-type '(x w32 ns pgtk)) > > > t) > > > + ((terminal-parameter display 'display-selections-p) > > > + t) > > > > This should test xterm--set-selection parameter. > > OK, so the goal is to check the xterm--set-selection terminal > parameter and variable xterm-select-active-regions before selecting > the active region in deactivate-mark in simple.el. > > We could do this in display-selections-p, but given that these > variables are not obviously related to display-selections-p, it seems > to me we probably want to do this check in deactivate-mark instead. > Does that seem reasonable to you? I think I'd prefer to have it in display-selections-p, like your last version did, just using xterm--set-selection terminal parameter, not the new one you invented. > > I think the code should instead check the value of > > xterm-select-active-regions in keyboard.c, where it decides whether to > > set PRIMARY. (Let me know if you need guidance for how to reference a > > Lisp variable from C.) > > This seems to work -- is there a better way? > > !NILP (SYMBOL_VAL (XSYMBOL (Qxterm_select_active_regions))) This is not safe, IMO. I think this is better: if ((!NILP (Fwindow_system (Qnil)) || ((symval = find_symbol_value (Qxterm_select_active_regions), (!EQ (symval, Qunbound) && !NILP (symval))) && !NILP (Fterminal_parameter (Qnil, Qxterm__set_selection)))) > I've also addressed Po's comments about long conditionals. Thanks, the patch LGTM, modulo the above 2 minor nits.