From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Duncan Findlay via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#55883: [PATCH] Update X Primary Selection with active regions Date: Tue, 14 Jun 2022 19:01:58 -0700 Message-ID: References: <834k0t104u.fsf@gnu.org> <8335gbzled.fsf@gnu.org> <837d5jtp9x.fsf@gnu.org> Reply-To: Duncan Findlay Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0000000000003eedb305e172eac6" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39692"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55883@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 15 04:43:44 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 1o1J0S-000A4k-Hl for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 15 Jun 2022 04:43:44 +0200 Original-Received: from localhost ([::1]:58102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1J0R-0000Qo-2v for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Jun 2022 22:43:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1Ixs-0000QZ-6q for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 22:41:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42298) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1Ixq-0006eZ-Ob for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 22:41:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o1Ixq-0002RK-JN for bug-gnu-emacs@gnu.org; Tue, 14 Jun 2022 22:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Duncan Findlay Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 15 Jun 2022 02:41: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.16552608409335 (code B ref 55883); Wed, 15 Jun 2022 02:41:02 +0000 Original-Received: (at 55883) by debbugs.gnu.org; 15 Jun 2022 02:40:40 +0000 Original-Received: from localhost ([127.0.0.1]:36195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1IxT-0002QT-8X for submit@debbugs.gnu.org; Tue, 14 Jun 2022 22:40:40 -0400 Original-Received: from mail-wr1-f46.google.com ([209.85.221.46]:41805) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o1IMk-0001S4-AC for 55883@debbugs.gnu.org; Tue, 14 Jun 2022 22:02:44 -0400 Original-Received: by mail-wr1-f46.google.com with SMTP id k19so13395265wrd.8 for <55883@debbugs.gnu.org>; Tue, 14 Jun 2022 19:02:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AxDp4Ygckt31fAcHma1XrP5k2g2cghbLjpYyIPMzISw=; b=BxcTqVu05ehxkKrN5x/fk+lXlP1bH4noYuJM+mdEsmza8fCsS0mgUsWfx+MfTxSZnO BNYSXkkycgf3JOwwlYRTOZ1r1JWh0rjPsKWU3I3fr+FG7ZxPmPT4YBz51rxqGy2Cpf5K BfMQbMDT0p23yN2PaPR/2TAoU0qzL9EXTsETEBNjYvP6qywCQkOd7oZXBc9idNUpE4PC C8W93GHr5YrvpcoKW0Ula75iIaAESOiqudZltWVXRSYASmf0shmctlGxpZFnWO8kv0bs 4Hv2+3R0kA3zQZtDDwO720/pTDeO+hclLv9ZuskRBOL8vX2NwTxpoHlAmFjKnDMM4YBF lqYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AxDp4Ygckt31fAcHma1XrP5k2g2cghbLjpYyIPMzISw=; b=vzrWcuoHUL9SPZFgItbty3FoLLOEv8v5IIIavhntkYd1m7svk/kGlvYode7ff+oNrA JPpUTSreadzjUwmj/sqNXQ+JrXmKT56Xm3GD65o0xSPn/Uv9ehJL+dA4f90Qc8xI5QUC bRbbx6QTOMl77Pt9gKAFEWPj5WGqRQtVKM5/lC3SuoJr8jkavy1IZnIR0LL9F5evflHJ MPYlO+AnLqFWAN6r9CuYsPP0XWl8vMGjHdgYr0qBBK1K0sCbYLet/vFlayEgif5LiAxS oZgzh8TfD04KBUX0ypknOZ4yhRtaSvV0fVG6giy5be+oSDKZfHFFHY4AdR3T3npdn6kt DUkw== X-Gm-Message-State: AJIora9b5JLPjWc46BfDUXW9ZMgSQAsAlmx18IcJyHf2283biJ4q3DR+ KvqIwm+m2eLPMCYoH7Jp8jIljvEaRkWqV01NkegUWBBEj1g= X-Google-Smtp-Source: AGRyM1tkPIYcSUjF/htiaQ9RquaL+lgGXvbPH6DekuKbOoZkSvGmqjyAfcZ3Q4TViDS0DfjGg70WkhJ3+mibPbTGqwk= X-Received: by 2002:a5d:5581:0:b0:20f:fc51:7754 with SMTP id i1-20020a5d5581000000b0020ffc517754mr7382762wrv.413.1655258556020; Tue, 14 Jun 2022 19:02:36 -0700 (PDT) In-Reply-To: <837d5jtp9x.fsf@gnu.org> X-Mailman-Approved-At: Tue, 14 Jun 2022 22:40:38 -0400 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:234551 Archived-At: --0000000000003eedb305e172eac6 Content-Type: text/plain; charset="UTF-8" On Tue, Jun 14, 2022 at 5:15 AM Eli Zaretskii wrote: > > > 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. Updated. > > > 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)))) Thanks, I would never have figured that out myself. > > I've also addressed Po's comments about long conditionals. > > Thanks, the patch LGTM, modulo the above 2 minor nits. Duncan --0000000000003eedb305e172eac6 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Support-select-active-regions-with-xterm.patch" Content-Disposition: attachment; filename="0001-Support-select-active-regions-with-xterm.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l4ey4eju0 RnJvbSA5OTMzN2QxNWYzZTBhZWNkNTdkZDIzOGM5NjE2ZGY4M2QxYWU4MmE2IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBEdW5jYW4gRmluZGxheSA8ZHVuY2ZAZ29vZ2xlLmNvbT4KRGF0 ZTogRnJpLCAxMCBKdW4gMjAyMiAxODo0Njo0OSAtMDcwMApTdWJqZWN0OiBbUEFUQ0hdIFN1cHBv cnQgYHNlbGVjdC1hY3RpdmUtcmVnaW9ucycgd2l0aCB4dGVybQoKVGhpcyBhbGxvd3MgRW1hY3Mg dG8gc2F2ZSB0aGUgYWN0aXZlIHJlZ2lvbiB0byB0aGUgdXNlcidzCnByaW1hcnkgc2VsZWN0aW9u IG9uIHN1cHBvcnRlZCB0ZXJtaW5hbHMuICBUaGUgYmVoYXZpb3IgZm9sbG93cwp0aGUgZXhpc3Rp bmcgYHNlbGVjdC1hY3RpdmUtcmVnaW9ucycgdmFyaWFibGUgYW5kIHJlcXVpcmVzCmB4dGVybS1z ZWxlY3QtYWN0aXZlLXJlZ2lvbnMnIHRvIGJlIG5vbi1uaWwuCgoqIHNyYy9rZXlib2FyZC5jIChj b21tYW5kX2xvb3BfMSk6CiogbGlzcC9mcmFtZS5lbCAoZGlzcGxheS1zZWxlY3Rpb25zLXApOiBP biB0ZXh0IHRlcm1pbmFscywgY2hlY2sKdGVybWluYWwgcGFyYW1ldGVyIG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