From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Gerd =?UTF-8?Q?M=C3=B6llmann?= <gerd.moellmann@gmail.com>
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, 14 Dec 2024 10:40:50 +0100
Message-ID: <m2ldwi8uvx.fsf@gmail.com>
References: <m1cyhweqhe.fsf@fastmail.fm> <8634iszpa5.fsf@gnu.org>
 <CAN+1Hbr1k9vOBfB_rSxOTPnB51wM_w132hG7k_1Y61FkBDs=tQ@mail.gmail.com>
 <86y10ky9wf.fsf@gnu.org>
 <CAN+1HbrAA9HuGp-VFfQUbFLfu87B=2u6xYKs-=RR64p4Z7Ozfw@mail.gmail.com>
 <86wmg4xd2u.fsf@gnu.org> <m1y10jo81o.fsf@fastmail.fm>
 <86y10jwmsb.fsf@gnu.org> <m1msgznx20.fsf@fastmail.fm>
 <86ldwiwvjc.fsf@gnu.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="8023"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cc: Jared Finder <jared@finder.org>, 74833@debbugs.gnu.org,
 Filipp Gunbin <fgunbin@fastmail.fm>, shipmints@gmail.com
To: Eli Zaretskii <eliz@gnu.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 14 10:42:14 2024
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
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 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1tMOf6-0001vJ-N7
	for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 14 Dec 2024 10:42:12 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1tMOey-00022M-Dl; Sat, 14 Dec 2024 04:42:04 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1tMOex-000228-0t
 for bug-gnu-emacs@gnu.org; Sat, 14 Dec 2024 04:42:03 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1tMOew-00026J-P5
 for bug-gnu-emacs@gnu.org; Sat, 14 Dec 2024 04:42:02 -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=Ky/lsHyxDtaJBLnsGxaQirNC1F6jE5/Aucqhl+jlpfA=; 
 b=JlBeFFrICMkxr8ZsohtPydVkl5oiLxEhYXFbZYkxFZ52Yv0LBm7CQI6LQICNJAeI0lBhA07qk6BWXi5ew+JZD6SDwmyuU5ggpEilZnFS9SKP8MijxYTovyD8U6+jpx5jzPBRzvs+iP7A8JCMYnT2kgrDZEPa8H1PE9EhwrqqhV0yLtNKWEDANyNLuD83m+ggo1wxOBFBj9t/p0hlD5pHodiT9MqxhVlKvwymvEWhjEkTz5A0J3zzy/qFjpN9tLOk0KyEdxTKJiJNZYM9iyJXLphvlBA+Png4Yldwdq2ZcKwP/pmhUbdFi2jsmsdgoPInXHqLrzwTNx3Oy+QCA11M2g==;
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1tMOew-0006z7-Bs
 for bug-gnu-emacs@gnu.org; Sat, 14 Dec 2024 04:42:02 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Gerd =?UTF-8?Q?M=C3=B6llmann?= <gerd.moellmann@gmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sat, 14 Dec 2024 09:42:02 +0000
Resent-Message-ID: <handler.74833.B74833.173416932126842@debbugs.gnu.org>
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.173416932126842
 (code B ref 74833); Sat, 14 Dec 2024 09:42:02 +0000
Original-Received: (at 74833) by debbugs.gnu.org; 14 Dec 2024 09:42:01 +0000
Original-Received: from localhost ([127.0.0.1]:45487 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1tMOeu-0006yr-EK
 for submit@debbugs.gnu.org; Sat, 14 Dec 2024 04:42:00 -0500
Original-Received: from mail-ed1-f54.google.com ([209.85.208.54]:52571)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gerd.moellmann@gmail.com>) id 1tMOes-0006yZ-50
 for 74833@debbugs.gnu.org; Sat, 14 Dec 2024 04:41:59 -0500
Original-Received: by mail-ed1-f54.google.com with SMTP id
 4fb4d7f45d1cf-5d3f28881d6so3157992a12.1
 for <74833@debbugs.gnu.org>; Sat, 14 Dec 2024 01:41:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1734169252; x=1734774052; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=Ky/lsHyxDtaJBLnsGxaQirNC1F6jE5/Aucqhl+jlpfA=;
 b=cGvmRscM4o0xb371aW+H6lMFCQ5E+5jWIctgXdXzaE6CIQql6M6kxA1uFm5SwsNL3v
 LJWJvCIV/+fh2CE55scRne4gGBj9oTJekWJI/kEhkMfMghhC85UE1O6Dwh2ND0DR2ntx
 FRVcserNQ9MDq36yX2BvuPVA6zwqMXvli9NPYCeHei7JlFS71yvIHL0A0dCf7ZHPNV4V
 Y8T7RDaBjcGultyQhr/KWzFbiDQeHpVNdJqQ9GM4Rzba16EUp2TsqhblNdjuvLLrrYal
 Aexpjgn8nrqvB2VcAHoQA6Gt0RmIsEuS+uLmbjlyK7JzDRYE3cpuIaChzX/j5Pjn0ugp
 7WAQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1734169252; x=1734774052;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Ky/lsHyxDtaJBLnsGxaQirNC1F6jE5/Aucqhl+jlpfA=;
 b=CDgCHDkv7pxefKArqyKFlYj95yaLOOU1Fx7V/4jUpKYIajN3Zvztjc24mx3cN2gqer
 7z+hSjh5x6MizfrzJsKZK2E5EWEEkFnr+k35AM4bDTPielurOXYt27DKZZQyzukdjYuq
 vqzfpr30HBeF8a/keXtZdsw8jLaksOWinga17e72S8NkIhOqsaGi2QsEOTSm7lij4lBL
 CnfZpDEAb3hUEwO5M9NBK0ywn72jbK/MCbp/1jGTicsxwuOIghHFzsUIj2MmiWZbUQD8
 VecNQAlNy5rl80Dldeh8eVOsuptpYkUcDeC5ZhL1apI+prEjlnasy4UqVpbuCCZHThhn
 DPkA==
X-Forwarded-Encrypted: i=1;
 AJvYcCWwkwYOewd1quIBkjI1bS9mTxftb25oAdTDbWw2bk1vnyaHTliYmwrlB8VSUYWv8oI4YoqAKQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyjHU8+ME5GtbxXnvR66VCuz5RxB6a2voGlyWcLlUIR1XRCT5Lr
 WZzqxfrR1Ng+yrXOlCe8eSQmMGQuYksiSOAI3R6oubM5fzmm25Ca
X-Gm-Gg: ASbGncuM1kZp8gzT1Brxs4ilq1XRDWhpE79tS2NNE0JvLrY0lBaBrdX5hUVcGvGT3lX
 CgZ8eQMjkvV0bjEiWnZrmYSqa2giX8x9v+NvMNeVRxTkKmbT7KA5lk0VdXXP+W2BxCOtjJ4nNmr
 7JVn7Qz/NIS6p3eZ5P+D/iMv/QLVX9d3k6yUdsQxTXjRA52qW9HwbGPQyXI5vA9hHcfXgZqjyYe
 4K1qDepCAw4eYFFMrhQf7tte/F0Ktlz/bgito1o1DcRxhbIPFvymtsdbwcF7IMYQtn7jf9Bngsk
 aYM0D2j6eBIMp950AbYAtpGlJpxXKNw3IrP36TDhDLMeDWQ6V8pZ8rSpyf+n9FleSA==
X-Google-Smtp-Source: AGHT+IF+nuQijMMwBgZ/yM0NU+9vKH8I7v5T3PmeIj0D2ZTj7zdkYm4yR4TtX8p6c3YScfQQ60YqYw==
X-Received: by 2002:a05:6402:3884:b0:5d3:cff5:635e with SMTP id
 4fb4d7f45d1cf-5d63c3dbba0mr13048925a12.26.1734169252144; 
 Sat, 14 Dec 2024 01:40:52 -0800 (PST)
Original-Received: from pro2 (p200300e0b713730071139a278fc518ee.dip0.t-ipconnect.de.
 [2003:e0:b713:7300:7113:9a27:8fc5:18ee])
 by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-aab9638ec3dsm72977166b.150.2024.12.14.01.40.51
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 14 Dec 2024 01:40:51 -0800 (PST)
In-Reply-To: <86ldwiwvjc.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 14 Dec
 2024 09:52:55 +0200")
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" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=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:297025
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/297025>

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Filipp Gunbin <fgunbin@fastmail.fm>
>> Cc: shipmints@gmail.com,  74833@debbugs.gnu.org
>> Date: Fri, 13 Dec 2024 23:32:39 +0300
>> 
>> On 13/12/2024 18:49 +0200, Eli Zaretskii wrote:
>> 
>> >> From: Filipp Gunbin <fgunbin@fastmail.fm>
>> >> Cc: Ship Mints <shipmints@gmail.com>,  74833@debbugs.gnu.org
>> >> Date: Fri, 13 Dec 2024 19:35:15 +0300
>> >>
>> >> On 13/12/2024 09:21 +0200, Eli Zaretskii wrote:
>> >>
>> >> > So why is this an Emacs bug?  It sounds like the OP expects something
>> >> > to happen which shouldn't, because the xterm protocol for selections
>> >> > and the clipboard are not supported by Terminal.app?  In that case,
>> >> > this could be at best a feature request, not a bug.
>> >>
>> >> I'll try to explain differently.
>> >>
>> >> Without xterm-mouse-mode you can copy/paste from/into Terminal.app
>> >> window, looks like Terminal.app gives this ability on its own.  This is
>> >> not integration with Emacs kill ring, no.  Emacs cursor does not react
>> >> to mouse clicks, and selection happens with OS mouse pointer.  Paste
>> >> works rather slow (bad idea to paste large chunks of text), but
>> >> tolerable.
>> >>
>> >> Now, yesterday my daily master build got me xterm-mouse-mode enabled, so
>> >> I did some testing just out of curiosity.  Most of the things work,
>> >> including clicking and selection.  However, Command-C now just doesn't
>> >> copy text to OS clipboard.  And it's non-obvious that you should disable
>> >> xterm-mouse-mode to be able to copy.
>> >
>> > xterm-mouse-mode is supposed to be enabled only on terminals that load
>> > xterm.el, which means they are xterm-compatible.  Does Terminal.app
>> > load xterm.el on startup?
>> 
>> Terminal.app sets TERM=xterm-256color (this is configurable in "Settings
>> -> Profiles -> Advanced -> Declare terminal as", I doubt I ever changed
>> it), so xterm.el should be loaded, yes.
>> 
>> Other term-related vars are:
>> 
>> TERM_PROGRAM=Apple_Terminal
>> TERM_PROGRAM_VERSION=453
>> TERM_SESSION_ID=1251C872-8246-4380-A2AE-ED1F8B649878
>
> Then we should amend xterm.el to not allow xterm-mouse on this
> terminal.  Jared, could you please add such a condition?
>
> And I think the Terminal.app developers should be told that pretending
> to be xterm without full support for all the xterm features is not
> TRT, and they should stop.  Would someone please file an issue with
> their issue tracker?

I still think that this is a cockpit error.

Terminal.app's Command-C can only copy a selection that the app knows
about. If the mouse is used by an app like Emacs (Terminal.app's
Settings/Report ....)) the user tells Terminal to let the app use the mouse.
I find it little surprising that when Terminal.app does that, it doesn't
use the mouse itself to make a selection it could then copy.

Do Command-A Command-C and see what happens.

Or use Command-R to toggle the mouse reporting setting on the fly.

Or use xclip in Emacs.

Please don't disable xterm-mouse for this.