From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Duncan Findlay Newsgroups: gmane.emacs.devel Subject: Re: Set X primary selection with Emacs in xterm Date: Fri, 10 Jun 2022 19:03:50 -0700 Message-ID: References: <83y1yecjzx.fsf@gnu.org> <83ilp8z4tx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14622"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 11 07:39:48 2022 Return-path: Envelope-to: ged-emacs-devel@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 1nztqd-0003e5-ME for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Jun 2022 07:39:47 +0200 Original-Received: from localhost ([::1]:55508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nztqc-0005bq-3Q for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Jun 2022 01:39:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzqUM-0003Hp-A2 for emacs-devel@gnu.org; Fri, 10 Jun 2022 22:04:34 -0400 Original-Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:34087) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzqUK-0004CN-DV for emacs-devel@gnu.org; Fri, 10 Jun 2022 22:04:33 -0400 Original-Received: by mail-wm1-x332.google.com with SMTP id p6-20020a05600c1d8600b0039c630b8d96so2389620wms.1 for ; Fri, 10 Jun 2022 19:04:31 -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=52kI2TZ83/R/dijgtTsMSwzSniK5Hv6LV1qZwjoQz5w=; b=UCE+CXn2UIUHS3MAtmuHose/fkjepe1pm8zs7cp5Jmrg31ph6obdMF9K8A0ftMT4AT Yt3//GD51FzwnCBB8evq5SoKhWXJ59Dcv0AgkJ0Q7ywR6uPdpBPttIyse3ph1H+MtJad jOxQTinO9FYOtskF3uAC8fFTGk3E8h0qw0CGeAaCJ00TmfJErVoGpxVH1c3rNieCvANp QDb+SQ5S3P6iaCQAxy6imkCiSEM4B0w88PpJ1ec9Vhz2o5gIQ2LkiWlshXX8SHdlKj+W U9Vl59W1ms6jU2uD9so46BtdBzUt1RTPJJrGyYPOoLqJl2Y9cTERhNNJM10SP4bCrsND CQoA== 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=52kI2TZ83/R/dijgtTsMSwzSniK5Hv6LV1qZwjoQz5w=; b=PzuDfyn7HqwYtzV3IeQ4xTc70SWb2Kv5fFIqd5eubyMWAHaRd3YKnoDrbg0pS3C8MB bXVjN7X+b+sB4/LwmK7UrMFzULDlRFUJNZ1/cjVwSznFKsqD/oaGt+QJQ8s38O0WAkCI RswmdLrXW92hfgvR6WOJbu1XJ9qFX2g7m3AydBrG+dMN7MPYThR93lUPvVv3KKdzsv9M +bPwA+jHu/7rrUfEf+XfpnEvUDJ/zkXTBVBN7/8h7H9Ti+sL6USDXeGA+76QbvKbV8j/ F+y3SuNoUacuYrlQqCE8Y8uC6xuzRzWpocxo9ovW5UeKzZ5ULmO1pe8cdUzXocv5ajBr kfWg== X-Gm-Message-State: AOAM530CaxrozWAq6HXyzn2FFmfJLTXmEpACsulVTnUbF7/d5i9tLxGe ISeltuwSz/Jt0Yt9xw3Yc2x/TBl4zcvrbSIgR8c9j2W0OkI= X-Google-Smtp-Source: ABdhPJxITYLPqHB1zRRVSlUzTkkby/I54YnGFRRIybXJXBeaYDfOnYVrasfFulcLNdJ7R9fJTxM1qYml2Jnd1TOpYWQ= X-Received: by 2002:a1c:a301:0:b0:392:9bc5:203c with SMTP id m1-20020a1ca301000000b003929bc5203cmr2472165wme.67.1654913070539; Fri, 10 Jun 2022 19:04:30 -0700 (PDT) In-Reply-To: <83ilp8z4tx.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=duncf@google.com; helo=mail-wm1-x332.google.com X-Spam_score_int: -175 X-Spam_score: -17.6 X-Spam_bar: ----------------- X-Spam_report: (-17.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 11 Jun 2022 01:36:57 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:291016 Archived-At: On Fri, Jun 10, 2022 at 12:38 PM Eli Zaretskii wrote: > > > From: Duncan Findlay > > Date: Fri, 10 Jun 2022 11:10:50 -0700 > > Cc: emacs-devel@gnu.org > > > > On Thu, Jun 2, 2022 at 11:56 PM Eli Zaretskii wrote: > > > > > Thanks. I think we should solve this differently. I don't think it's > > > a good idea to call arbitrary Lisp from input-processing loop in > > > keyboard.c, anymore than we already do (which is already too much, > > > IMNSHO), especially if we envision advices for that code. > > > > > > We should instead modify the condition in command_loop_1 to support > > > terminals that can set GUI selections. terminal-parameter is a > > > primitive written in C, so command_loop_1 could call it directly (it > > > should also pay attention to the defcustom described below). > > > > I considered this, but given that we're making the same decision in > > lisp/simple.el (deactivate-mark) using display-selections-p, the > > benefits of sharing an implementation seemed compelling. > > That's not what bothers me, as I explain above. I don't want us to > call more Lisp from the loop that processes keyboard input, if that > can be avoided. And in this case, it can be easily avoided. > > > I see your point about wanting to minimize lisp in the command loop. > > Can we just port display-selections-p to C and use it from both > > places, or will that break things? > > I see no need for doing that. display-selections-p is okay in Lisp, > as it is called from Lisp programs. Got it -- thanks. This ended up being not nearly as difficult as I'd feared. > > > > + ((and (memq frame-type '(t)) > > > > + (eq (terminal-parameter nil 'xterm--set-selection) t)) > > > > + t) > > > > > > This is unnecessarily strict: there should be no need to test > > > frame-type, since any frame type could arrange for this parameter when > > > it supports selections. > > > > In practice, are there other frame types? Is it reasonable to set > > terminal-parameter for other frame types? > > Maybe not today, but I'd like this code to be more future-proof. > There's no need to test for more things that are absolutely necessary, > and testing for the xterm--set-selection parameter is enough in this > case, isn't it? I've sent a new version that addresses this, too. https://debbugs.gnu.org/55883 Thanks for bearing with me on this. Duncan