From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jared Finder via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled Date: Sat, 28 Dec 2024 21:16:28 -0800 Message-ID: References: <8634iszpa5.fsf@gnu.org> <86y10ky9wf.fsf@gnu.org> <86wmg4xd2u.fsf@gnu.org> <86y10jwmsb.fsf@gnu.org> <86ldwiwvjc.fsf@gnu.org> <86ed27pfhj.fsf@gnu.org> <86a5cvpeiv.fsf@gnu.org> <86y10eo5h6.fsf@gnu.org> <986a3eea465e13c57bcdd7ce8f27f99d@finder.org> <864j2w6tz0.fsf@gnu.org> <861pxy5zxk.fsf@gnu.org> <86jzbq4i6x.fsf@gnu.org> <86frme4exq.fsf@gnu.org> <865xn5y2n0.fsf@gnu.org> <5e102d7d29eba618874c0b41e9815b8d@finder.org> <86ldw0ur0h.fsf@gnu.org> Reply-To: Jared Finder Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2380"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, 74833@debbugs.gnu.org, fgunbin@fastmail.fm, shipmints@gmail.com, rms@gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 29 06:17:31 2024 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 1tRlgA-0000UR-Nt for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 Dec 2024 06:17:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRlfn-0002cW-HR; Sun, 29 Dec 2024 00:17:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRlfk-0002c7-Sm for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 00:17:05 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tRlfj-0008Bs-1k for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 00:17:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:MIME-Version:To:Subject; bh=5rNaQ1YTVcqZ+96wv9C7aO4uhuupjbAIoGWHLcdeAK4=; b=GEgnpO0WgFZVlWTwQ2sA9fBDAx8GuysfDt/vtYAXx9rE2uKtU7Rv6BrWCmm3GVJ/ZD/qcIINFcoVxu2tATyztUM8pljkeVhNxQDPJziM4ugyA6KThDysOQSCFdMrsBFWH1DL3T1aqPsCcbsN3c2N/XCrnLz43KOXczFxGm2ij3ohdtnirhJRwl1W1/F7/PR3edgHjZ0A9a5N3vMTdDN8tKwEJCCKZ+52vPDlVWiZ9hNHPYguPT+tzI8SNFAh72WitOXpl/5Mlcq0z8C80SgktujmwE+cWa8zFxe84sVi42R6mHMpk1F6fNnb5j37yppVmPjfvKddS+Hltcio1LPsow==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tRlfh-0000yf-T2 for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 00:17:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jared Finder Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Dec 2024 05:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74833 X-GNU-PR-Package: emacs Original-Received: via spool by 74833-submit@debbugs.gnu.org id=B74833.17354493963722 (code B ref 74833); Sun, 29 Dec 2024 05:17:01 +0000 Original-Received: (at 74833) by debbugs.gnu.org; 29 Dec 2024 05:16:36 +0000 Original-Received: from localhost ([127.0.0.1]:53444 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRlfE-0000xr-Q9 for submit@debbugs.gnu.org; Sun, 29 Dec 2024 00:16:36 -0500 Original-Received: from greenhill.hpalace.com ([192.155.80.58]:33318) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRlfB-0000xc-T5 for 74833@debbugs.gnu.org; Sun, 29 Dec 2024 00:16:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=finder.org; s=2018; t=1735449388; bh=17q4R2lyXRaPbxcnGXqG2c7twHLvqPRPbdjGnj9m49M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=tWcj7ca37GVck8Oxkch1znYkLW71xEjZrnsIpzEiiF6cKF9cAtoZqh6RvSZvWY6cY Cj7xMko09lP/u4EjqYwkqrOq2OJpT0Mfpwf6wyDpWfYt0+y6nOEBQVA1bnWQxJqSjv J7nxh9PDICBUHka8dMmUgeF8AyKLFTUIOk+RsTXzr2rIDqpWbV1bO2EQGcawtkSO4i JMm2I27UCoNq7w0K6Odhm5p/UkkYl60VSNw3LQfO+VOLWSgKAZwDX5Z3V50cJNoImJ hlXYWXuHiLlwsT0LcNZp75q/qKpE9vjl72CUF2SM1XWp5vTR/5Sd0bXQbXvaDCPNDD kvAqkT7cWlqxA== Original-Received: from mail.finder.org (unknown [192.155.80.58]) by greenhill.hpalace.com (Postfix) with ESMTPSA id BD2EA3C8; Sun, 29 Dec 2024 05:16:28 +0000 (UTC) In-Reply-To: <86ldw0ur0h.fsf@gnu.org> X-Sender: jared@finder.org 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:297928 Archived-At: On 2024-12-28 00:54, Eli Zaretskii wrote: >> Date: Fri, 27 Dec 2024 23:08:27 -0800 >> From: Jared Finder >> Cc: shipmints@gmail.com, rms@gnu.org, gerd.moellmann@gmail.com, >> fgunbin@fastmail.fm, 74833@debbugs.gnu.org >> >> >> What if we only auto-enabled xterm-mouse-mode on OSC52 compatible >> >> terminals? >> > >> > On OSC52 compatible terminals, or on OSC52 compatible terminals that >> > define TERM to xterm-like string? The latter sounds like a good idea >> > to me, but only if support for OSC52 necessarily means xterm-mouse >> > escape sequences must be supported. Is this conjecture indeed true? >> >> I'm proposing Emacs have a manually curated allow list for now for >> auto-enabling xterm-mouse-mode. Being OSC52 compatible gets us the >> copy >> / paste issue this bug mentioned. We can add other conditions going >> forward. > > What would this allow list specify, and in what terms? > > When reading your proposal above, I thought we have a means of testing > the OSC52 support, but now you seem to be saying that this support > should be somehow specified by a database of terminals we maintain? > ANd if so, the question of detecting a non-xterm terminal that sets > TERM to xterm but doesn't support OSC52 still stands, doesn't it? Yes, that's right. Unfortunately we are limited in two ways: 1. Setting TERM to xterm is commonly done by alternative terminals, even though they do not fully support all of xterm's functionality. I'd estimate that over 80% of alternative terminals just set TERM to xterm-256color. This includes the default terminals for Mac (Terminal.app), Windows (Windows Terminal), GNOME (GNOME Terminal), and KDE (Konsole). 2. There is no way to check if OSC52 is supported. >> >> Between $TERM and the results from the terminal escape >> >> sequence "ESC [ > 0 q", Emacs can have high confidence if it is >> >> running >> >> on an OSC52 compatible terminal. I checked against most of the >> >> terminals >> >> mentioned at >> >> https://can-i-use-terminal.github.io/features/osc52copy.html I just >> >> wasn't able to test Foot (Wayland-only), hterm (Chromebook-only), >> >> mintty >> >> (Cygwin-only), or xterm.js (I have no idea how to test). >> > >> > How do I check this? can you show some script or Lisp or whatever you >> > used to check? >> >> Run the following lisp code in Emacs: >> >> (progn >> (send-string-to-terminal "\e[>0q") >> (let ((str "") >> chr) >> (while (setq chr (xterm--read-event-for-query)) >> (setq str (concat str (string chr)))) >> str)) >> >> You should get the string "\eP>|terminal name and version\e\\". For >> example, under iTerm2 I get iTerm2 3.5.10 as the terminal name and >> version and under Kitty I get kitty(0.38.1). > > And if the terminal does NOT support OSC52, what should I expect to > happen? I'm proposing to add a single regexp that matches against the terminal name and version string. If there's a match, automatically enable xterm-mouse-mode. For terminals that aren't supported or don't support "\e[>0q", leave xterm-mouse-mode as is. No other complexity is needed. A user can always customize xterm-mouse-mode (it's a user option) if they want to enable it anyways. -- MJF