From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier 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: Mon, 06 Jan 2025 13:25:31 -0500 Message-ID: References: <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> <86h66nq7vh.fsf@gnu.org> <83cf221bcf4fc4162c7401b9146d1961@finder.org> <867c7dljph.fsf@gnu.org> <6b8d9d19697dae5f0b4a06920e559dc1@finder.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14199"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 74833@debbugs.gnu.org, rms@gnu.org, gerd.moellmann@gmail.com, shipmints@gmail.com, Eli Zaretskii , fgunbin@fastmail.fm To: Jared Finder Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 06 19:26:31 2025 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 1tUro7-0003X7-59 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 Jan 2025 19:26:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUrnj-0003XG-Tb; Mon, 06 Jan 2025 13:26: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 1tUrnh-0003X5-OV for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2025 13:26: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 1tUrnf-00023j-CG for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2025 13:26:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=XJg4Qot9Jfpdk5v7S5rvsQduyJ2OxgPrQunOdoD+Ljs=; b=Zw620gmPvKtpN8xYHAiw2oS6u+gMH41wYib4EQDm38QsuW7sTVo1Rqn5UgB8CUiXB/jq+LJdPtBUx9OL8qnSYKHXpHCtVmmEJpaoXqUc9ctVKPY5FFzm3yaHNA8waQiKSY3qpb3DIk2zpZBUb/SZMhkXYEJdlCIeEf/kI/ylP/oMzz+vCJvxwWWYHr+3F92SqlyztOKju9UWPi+mmnoLUrzwj8CBC95ezJ4mrrz4v53tSbp42IDFMxL3dqo22qQybOyJ9/mBXN/UohXXQ+cv4uhMuB+uBt0ofvg5tACk8W+z8CGNYnuVVmCYuHv4E/b61xQ6eMsA9YBsyio8yS64zw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tUrne-00033y-TD for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2025 13:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Jan 2025 18:26:02 +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.173618795711758 (code B ref 74833); Mon, 06 Jan 2025 18:26:02 +0000 Original-Received: (at 74833) by debbugs.gnu.org; 6 Jan 2025 18:25:57 +0000 Original-Received: from localhost ([127.0.0.1]:40029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUrnY-00033Z-ES for submit@debbugs.gnu.org; Mon, 06 Jan 2025 13:25:56 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:30442) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUrnU-00033F-Cw for 74833@debbugs.gnu.org; Mon, 06 Jan 2025 13:25:53 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 49AF280964; Mon, 6 Jan 2025 13:25:45 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1736187944; bh=vpI1ivBdHp4bO5pxSAGvmRKbDwP/7Z0lMdW63fn+EsI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=NAp56HIBInNJb3q/PN6d6/6w1SoKom65WgORo/wqJy7io9Mj62v8lRtY06kLOMxrk yhvGUHWiEee1Dd1/ssbULWGOFoycprUxIC6rbTT89nZCR5jGP6CnZtIQdtkqBUANN+ 78NgNaJboFBjRWs63zU04n0NHfywNds6+3fwxjwc7uQDJXq5ujJxleSLaAfFxknsx1 fyT3L97F4BfWtn3hYWMyOOf/IHYLy+MauLkovDcdTsPegN3J4Vx8Yz/BtUNXlS6vDK /GmvZXBH1t0Uamqst2a0TAXMAvbkiKvOtI5/6Zrt0bs9zeiTxw03s5qBcmVhsPxARd YQSJ8gjyq3WuQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 51AD6806F8; Mon, 6 Jan 2025 13:25:44 -0500 (EST) Original-Received: from alfajor (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2016F12014F; Mon, 6 Jan 2025 13:25:44 -0500 (EST) In-Reply-To: <6b8d9d19697dae5f0b4a06920e559dc1@finder.org> (Jared Finder's message of "Thu, 02 Jan 2025 08:55:02 -0800") 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:298682 Archived-At: > +(defconst xterm--auto-xt-mouse-allowed-names > + (mapconcat (lambda (s) (concat "^" s "\\>")) > + '("Konsole" > + "WezTerm" > + ;; "XTerm" ;Disabled because OSC52 support is opt-in only. > + "iTerm2" ;OSC52 support has opt-in/out UI on first usage > + "kitty") > + "\\|") Sounds good, tho I'd use (concat "\\`" (regexp-opt '(...)) "\\>") > +(defconst xterm--auto-xt-mouse-allowed-types > + (mapconcat (lambda (s) (concat "^" s "$")) > + '("alacritty" > + "contour") > + "\\|") Same here (with \` and \') > + "Like `xterm--auto-xt-mouse-allowed-names', but for the terminal's type. > +This will get matched against the environment variable \"TERM\".") We should clarify if it's an "and" or an "or": if only one of the two vars matches, is the feature enabled or not? > @@ -907,7 +963,15 @@ xterm--init > > (when xterm-set-window-title > (xterm--init-frame-title)) > - (when xterm-mouse-mode > + (when (and (not xterm-mouse-mode-called) > + ;; Only automatically enable xterm mouse on terminals > + ;; confirmed to still support all critical editing > + ;; workflows (bug#74833). > + (or (string-match-p xterm--auto-xt-mouse-allowed-types > + (tty-type (selected-frame))) > + (and-let* ((name-and-version (xterm--query-name-and-version))) > + (string-match-p xterm--auto-xt-mouse-allowed-names > + name-and-version)))) > (xterm-mouse-mode 1)) > ;; Unconditionally enable bracketed paste mode: terminals that don't > ;; support it just ignore the sequence. - The above enables `xterm-mouse-mode` which will then proceed to *not* obey `xterm--auto-xt-mouse-allowed-*` on any further ttys used in the same session. IOW, I think the above test belongs in `turn-on-xterm-mouse-tracking-on-terminal` rather than here. - Maybe instead of `xterm-mouse-mode-called` we should test (eq xterm-mouse-mode 'when-safe) or maybe rename the var to something more explicit like `xterm-mouse-mode-only-when-safe`. - Of course, the previous code was also very weird: (when xterm-mouse-mode (xterm-mouse-mode 1)) says to enable the mode, but only when it's already enabled?! Stefan