unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
@ 2024-12-12 17:54 Filipp Gunbin
  2024-12-12 18:08 ` Ship Mints
  2024-12-12 19:15 ` Eli Zaretskii
  0 siblings, 2 replies; 19+ messages in thread
From: Filipp Gunbin @ 2024-12-12 17:54 UTC (permalink / raw)
  To: 74833

macOS, Terminal.app, xterm-mouse-mode enabled
emacs -nw -Q
Select something with mouse, press Command-c
Try to paste into another program - text is not in the clipboard

Perhaps this is not new, I just tried xterm-mouse-mode for the first
time, given that it's now the default in master.

Trying different combinations of select-enable-clipboard and
select-enable-primary did not help (that variables are all I know in
this area).

Thanks.


In GNU Emacs 31.0.50 (build 43, aarch64-apple-darwin23.6.0, NS
 appkit-2487.70 Version 14.6 (Build 23G80)) of 2024-12-12 built on
 localhost
Repository revision: 9ccd459e8452cc9e6e81e53f26bbeef20d2d5bb7
Repository branch: master
System Description:  macOS 14.6

Configured using:
 'configure --enable-check-lisp-object-type --with-file-notification=no
 --with-native-compilation=no'

Configured features:
ACL GLIB GNUTLS LCMS2 LIBXML2 MODULES NS PDUMPER PNG RSVG SQLITE3
THREADS TOOLKIT_SCROLL_BARS WEBP XIM ZLIB





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-12 17:54 bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled Filipp Gunbin
@ 2024-12-12 18:08 ` Ship Mints
  2024-12-12 18:18   ` Filipp Gunbin
  2024-12-12 19:15 ` Eli Zaretskii
  1 sibling, 1 reply; 19+ messages in thread
From: Ship Mints @ 2024-12-12 18:08 UTC (permalink / raw)
  To: 74833

[-- Attachment #1: Type: text/plain, Size: 1275 bytes --]

You need something like https://elpa.gnu.org/packages/xclip.html to assist
connecting macOS terminal Emacs to the system pasteboard/clipboard.

On Thu, Dec 12, 2024 at 12:56 PM Filipp Gunbin <fgunbin@fastmail.fm> wrote:

> macOS, Terminal.app, xterm-mouse-mode enabled
> emacs -nw -Q
> Select something with mouse, press Command-c
> Try to paste into another program - text is not in the clipboard
>
> Perhaps this is not new, I just tried xterm-mouse-mode for the first
> time, given that it's now the default in master.
>
> Trying different combinations of select-enable-clipboard and
> select-enable-primary did not help (that variables are all I know in
> this area).
>
> Thanks.
>
>
> In GNU Emacs 31.0.50 (build 43, aarch64-apple-darwin23.6.0, NS
>  appkit-2487.70 Version 14.6 (Build 23G80)) of 2024-12-12 built on
>  localhost
> Repository revision: 9ccd459e8452cc9e6e81e53f26bbeef20d2d5bb7
> Repository branch: master
> System Description:  macOS 14.6
>
> Configured using:
>  'configure --enable-check-lisp-object-type --with-file-notification=no
>  --with-native-compilation=no'
>
> Configured features:
> ACL GLIB GNUTLS LCMS2 LIBXML2 MODULES NS PDUMPER PNG RSVG SQLITE3
> THREADS TOOLKIT_SCROLL_BARS WEBP XIM ZLIB
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 1778 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-12 18:08 ` Ship Mints
@ 2024-12-12 18:18   ` Filipp Gunbin
  2024-12-12 18:20     ` Ship Mints
  0 siblings, 1 reply; 19+ messages in thread
From: Filipp Gunbin @ 2024-12-12 18:18 UTC (permalink / raw)
  To: Ship Mints; +Cc: 74833

On 12/12/2024 13:08 -0500, Ship Mints wrote:

> You need something like https://elpa.gnu.org/packages/xclip.html to assist
> connecting macOS terminal Emacs to the system pasteboard/clipboard.

Thanks, BTW paste with Command-V works, it's just copy that doesn't
work.  Probably I'll disable xterm-mouse-mode anyway, but it would be
nice to have this resolved in Emacs.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-12 18:18   ` Filipp Gunbin
@ 2024-12-12 18:20     ` Ship Mints
  0 siblings, 0 replies; 19+ messages in thread
From: Ship Mints @ 2024-12-12 18:20 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: 74833

[-- Attachment #1: Type: text/plain, Size: 702 bytes --]

I think that's because Terminal.app is providing paste, not Emacs. If you
use Emacs commands to put text into the kill-ring, it has to make it from
there into the pasteboard/clipboard and that's what xclip does for you.

On Thu, Dec 12, 2024 at 1:18 PM Filipp Gunbin <fgunbin@fastmail.fm> wrote:

> On 12/12/2024 13:08 -0500, Ship Mints wrote:
>
> > You need something like https://elpa.gnu.org/packages/xclip.html to
> assist
> > connecting macOS terminal Emacs to the system pasteboard/clipboard.
>
> Thanks, BTW paste with Command-V works, it's just copy that doesn't
> work.  Probably I'll disable xterm-mouse-mode anyway, but it would be
> nice to have this resolved in Emacs.
>

[-- Attachment #2: Type: text/html, Size: 1187 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-12 17:54 bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled Filipp Gunbin
  2024-12-12 18:08 ` Ship Mints
@ 2024-12-12 19:15 ` Eli Zaretskii
  2024-12-12 19:18   ` Ship Mints
  2024-12-12 19:55   ` Gerd Möllmann
  1 sibling, 2 replies; 19+ messages in thread
From: Eli Zaretskii @ 2024-12-12 19:15 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: 74833

> From: Filipp Gunbin <fgunbin@fastmail.fm>
> Date: Thu, 12 Dec 2024 20:54:53 +0300
> 
> macOS, Terminal.app, xterm-mouse-mode enabled
> emacs -nw -Q
> Select something with mouse, press Command-c
> Try to paste into another program - text is not in the clipboard
> 
> Perhaps this is not new, I just tried xterm-mouse-mode for the first
> time, given that it's now the default in master.
> 
> Trying different combinations of select-enable-clipboard and
> select-enable-primary did not help (that variables are all I know in
> this area).

Does the macOS Terminal.app support the xterm mouse protocol?





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-12 19:15 ` Eli Zaretskii
@ 2024-12-12 19:18   ` Ship Mints
  2024-12-12 19:32     ` Eli Zaretskii
  2024-12-12 19:55   ` Gerd Möllmann
  1 sibling, 1 reply; 19+ messages in thread
From: Ship Mints @ 2024-12-12 19:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74833, Filipp Gunbin

[-- Attachment #1: Type: text/plain, Size: 892 bytes --]

It supports a subset of mouse behavior via this user setting:

https://support.apple.com/guide/terminal/turn-on-mouse-reporting-trmlc69728a5/2.12/mac/11.0

On Thu, Dec 12, 2024 at 2:16 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Filipp Gunbin <fgunbin@fastmail.fm>
> > Date: Thu, 12 Dec 2024 20:54:53 +0300
> >
> > macOS, Terminal.app, xterm-mouse-mode enabled
> > emacs -nw -Q
> > Select something with mouse, press Command-c
> > Try to paste into another program - text is not in the clipboard
> >
> > Perhaps this is not new, I just tried xterm-mouse-mode for the first
> > time, given that it's now the default in master.
> >
> > Trying different combinations of select-enable-clipboard and
> > select-enable-primary did not help (that variables are all I know in
> > this area).
>
> Does the macOS Terminal.app support the xterm mouse protocol?
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 1628 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-12 19:18   ` Ship Mints
@ 2024-12-12 19:32     ` Eli Zaretskii
  2024-12-12 20:07       ` Gerd Möllmann
  2024-12-12 20:31       ` Ship Mints
  0 siblings, 2 replies; 19+ messages in thread
From: Eli Zaretskii @ 2024-12-12 19:32 UTC (permalink / raw)
  To: Ship Mints; +Cc: 74833, fgunbin

> From: Ship Mints <shipmints@gmail.com>
> Date: Thu, 12 Dec 2024 14:18:47 -0500
> Cc: Filipp Gunbin <fgunbin@fastmail.fm>, 74833@debbugs.gnu.org
> 
> It supports a subset of mouse behavior via this user setting:
> 
> https://support.apple.com/guide/terminal/turn-on-mouse-reporting-trmlc69728a5/2.12/mac/11.0

That doesn't tell enough.  xterm.el and xterm-mouse assume full
support for the xterm protocols, so partial support could well explain
why things don't work.

In general, I don't recommend turn on xterm features on terminals
other than xterm, unless they are faithful emulations of xterm.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-12 19:15 ` Eli Zaretskii
  2024-12-12 19:18   ` Ship Mints
@ 2024-12-12 19:55   ` Gerd Möllmann
  1 sibling, 0 replies; 19+ messages in thread
From: Gerd Möllmann @ 2024-12-12 19:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74833, Filipp Gunbin

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Filipp Gunbin <fgunbin@fastmail.fm>
>> Date: Thu, 12 Dec 2024 20:54:53 +0300
>> 
>> macOS, Terminal.app, xterm-mouse-mode enabled
>> emacs -nw -Q
>> Select something with mouse, press Command-c
>> Try to paste into another program - text is not in the clipboard
>> 
>> Perhaps this is not new, I just tried xterm-mouse-mode for the first
>> time, given that it's now the default in master.
>> 
>> Trying different combinations of select-enable-clipboard and
>> select-enable-primary did not help (that variables are all I know in
>> this area).
>
> Does the macOS Terminal.app support the xterm mouse protocol?

Yes it does.

The clipboard problem is something unrelated. Terminal applications can
access the macOS clipboard via command line utilities pbcopy and
pbpaste. I'm using the package xclip for that, which is very simple to
use

  ;; Clipboard support in terminal Emacs using pbcopy/pbpaste.
  (use-package xclip :straight t
    :if (not (display-graphic-p))
    :config (xclip-mode 1))

Command-C, Command-V in Terminal.app are used by Terminal.app itself and
not by applications running in the terminal emulator. For example, to
copy shell output or paste something as shell input.

I don't think Terminal.app allows altering Command-V etc. so that Emacs
could use them. Other terminal emulators like iTerm allow doing that.

In summary, this is not a bug.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-12 19:32     ` Eli Zaretskii
@ 2024-12-12 20:07       ` Gerd Möllmann
  2024-12-12 20:31       ` Ship Mints
  1 sibling, 0 replies; 19+ messages in thread
From: Gerd Möllmann @ 2024-12-12 20:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74833, fgunbin, Ship Mints

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Ship Mints <shipmints@gmail.com>
>> Date: Thu, 12 Dec 2024 14:18:47 -0500
>> Cc: Filipp Gunbin <fgunbin@fastmail.fm>, 74833@debbugs.gnu.org
>> 
>> It supports a subset of mouse behavior via this user setting:
>> 
>> https://support.apple.com/guide/terminal/turn-on-mouse-reporting-trmlc69728a5/2.12/mac/11.0
>
> That doesn't tell enough.  xterm.el and xterm-mouse assume full
> support for the xterm protocols, so partial support could well explain
> why things don't work.
>
> In general, I don't recommend turn on xterm features on terminals
> other than xterm, unless they are faithful emulations of xterm.

There is, for some reason, a checkbox in Terminal.app Settings dialog
with which one can make Terminal.app not send xterm mouse escape
sequences. If it's off when Emacs runs it doesn't get informed about
mouse clicks and so on. So nothing happens.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-12 19:32     ` Eli Zaretskii
  2024-12-12 20:07       ` Gerd Möllmann
@ 2024-12-12 20:31       ` Ship Mints
  2024-12-13  7:21         ` Eli Zaretskii
  1 sibling, 1 reply; 19+ messages in thread
From: Ship Mints @ 2024-12-12 20:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74833, fgunbin

[-- Attachment #1: Type: text/plain, Size: 986 bytes --]

I have xterm-mouse-mode enabled when in tty mode on macOS and it does work
for clicking/selecting but this is independent of integrating the kill ring
with the pasteboard. I am unaware of how to test the completeness of the
xterm mouse protocol support, however.

On Thu, Dec 12, 2024 at 2:32 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Ship Mints <shipmints@gmail.com>
> > Date: Thu, 12 Dec 2024 14:18:47 -0500
> > Cc: Filipp Gunbin <fgunbin@fastmail.fm>, 74833@debbugs.gnu.org
> >
> > It supports a subset of mouse behavior via this user setting:
> >
> >
> https://support.apple.com/guide/terminal/turn-on-mouse-reporting-trmlc69728a5/2.12/mac/11.0
>
> That doesn't tell enough.  xterm.el and xterm-mouse assume full
> support for the xterm protocols, so partial support could well explain
> why things don't work.
>
> In general, I don't recommend turn on xterm features on terminals
> other than xterm, unless they are faithful emulations of xterm.
>

[-- Attachment #2: Type: text/html, Size: 1721 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-12 20:31       ` Ship Mints
@ 2024-12-13  7:21         ` Eli Zaretskii
  2024-12-13 14:46           ` Ship Mints
  2024-12-13 16:35           ` Filipp Gunbin
  0 siblings, 2 replies; 19+ messages in thread
From: Eli Zaretskii @ 2024-12-13  7:21 UTC (permalink / raw)
  To: Ship Mints; +Cc: 74833, fgunbin

> From: Ship Mints <shipmints@gmail.com>
> Date: Thu, 12 Dec 2024 15:31:00 -0500
> Cc: fgunbin@fastmail.fm, 74833@debbugs.gnu.org
> 
> I have xterm-mouse-mode enabled when in tty mode on macOS and it does work for clicking/selecting but
> this is independent of integrating the kill ring with the pasteboard. I am unaware of how to test the
> completeness of the xterm mouse protocol support, however.

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.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-13  7:21         ` Eli Zaretskii
@ 2024-12-13 14:46           ` Ship Mints
  2024-12-13 16:35           ` Filipp Gunbin
  1 sibling, 0 replies; 19+ messages in thread
From: Ship Mints @ 2024-12-13 14:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74833, fgunbin

[-- Attachment #1: Type: text/plain, Size: 969 bytes --]

I agree. I think OP was expressing surprise at features not working "out of
the box." I suppose macOS terminal xmouse and kill-ring pasteboard
integration deserve a mention in PROBLEMS.

On Fri, Dec 13, 2024 at 2:21 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Ship Mints <shipmints@gmail.com>
> > Date: Thu, 12 Dec 2024 15:31:00 -0500
> > Cc: fgunbin@fastmail.fm, 74833@debbugs.gnu.org
> >
> > I have xterm-mouse-mode enabled when in tty mode on macOS and it does
> work for clicking/selecting but
> > this is independent of integrating the kill ring with the pasteboard. I
> am unaware of how to test the
> > completeness of the xterm mouse protocol support, however.
>
> 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.
>

[-- Attachment #2: Type: text/html, Size: 1553 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-13  7:21         ` Eli Zaretskii
  2024-12-13 14:46           ` Ship Mints
@ 2024-12-13 16:35           ` Filipp Gunbin
  2024-12-13 16:42             ` Ship Mints
  2024-12-13 16:49             ` Eli Zaretskii
  1 sibling, 2 replies; 19+ messages in thread
From: Filipp Gunbin @ 2024-12-13 16:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74833, Ship Mints

On 13/12/2024 09:21 +0200, Eli Zaretskii wrote:

>> From: Ship Mints <shipmints@gmail.com>
>> Date: Thu, 12 Dec 2024 15:31:00 -0500
>> Cc: fgunbin@fastmail.fm, 74833@debbugs.gnu.org
>> 
>> I have xterm-mouse-mode enabled when in tty mode on macOS and it does work for clicking/selecting but
>> this is independent of integrating the kill ring with the pasteboard. I am unaware of how to test the
>> completeness of the xterm mouse protocol support, however.
>
> 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.

That's why I filed this bug - because previous behavior was not ideal
but working, and now only paste works.

Maybe we should just avoid enabling xterm-mouse-mode in Terminal.app.
Maybe functionality of xclip should be in core.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-13 16:35           ` Filipp Gunbin
@ 2024-12-13 16:42             ` Ship Mints
  2024-12-13 16:52               ` Ship Mints
  2024-12-13 16:49             ` Eli Zaretskii
  1 sibling, 1 reply; 19+ messages in thread
From: Ship Mints @ 2024-12-13 16:42 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: Eli Zaretskii, 74833

[-- Attachment #1: Type: text/plain, Size: 2554 bytes --]

What you describe is normal behavior, even if it appears confusing. It's an
"impedance mismatch" between terminal.app and being in a "curses" window.
Terminal doesn't "see" selected text and hence Command-C is disabled. This
is the opposite for a basic shell where terminal sees the text because
it controls selection. You can see this by pulling down the Edit menu and
seeing Copy grayed out. As far as how xterm-mouse-mode interferes with
Command-C I'd have to disable it myself and see what's going on. Not sure
how much value that adds, though. If you enable xclip, you'll get what you
want being inside Emacs, after all, using M-w gets your selected text
copied to the pasteboard.

On Fri, Dec 13, 2024 at 11:35 AM Filipp Gunbin <fgunbin@fastmail.fm> wrote:

> On 13/12/2024 09:21 +0200, Eli Zaretskii wrote:
>
> >> From: Ship Mints <shipmints@gmail.com>
> >> Date: Thu, 12 Dec 2024 15:31:00 -0500
> >> Cc: fgunbin@fastmail.fm, 74833@debbugs.gnu.org
> >>
> >> I have xterm-mouse-mode enabled when in tty mode on macOS and it does
> work for clicking/selecting but
> >> this is independent of integrating the kill ring with the pasteboard. I
> am unaware of how to test the
> >> completeness of the xterm mouse protocol support, however.
> >
> > 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.
>
> That's why I filed this bug - because previous behavior was not ideal
> but working, and now only paste works.
>
> Maybe we should just avoid enabling xterm-mouse-mode in Terminal.app.
> Maybe functionality of xclip should be in core.
>

[-- Attachment #2: Type: text/html, Size: 3323 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-13 16:35           ` Filipp Gunbin
  2024-12-13 16:42             ` Ship Mints
@ 2024-12-13 16:49             ` Eli Zaretskii
  2024-12-13 20:32               ` Filipp Gunbin
  1 sibling, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2024-12-13 16:49 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: 74833, shipmints

> 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?

> Maybe we should just avoid enabling xterm-mouse-mode in Terminal.app.

It should already be so, AFAIU.

> Maybe functionality of xclip should be in core.

Only if its developer submits it for inclusion.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-13 16:42             ` Ship Mints
@ 2024-12-13 16:52               ` Ship Mints
  2024-12-13 20:46                 ` Filipp Gunbin
  0 siblings, 1 reply; 19+ messages in thread
From: Ship Mints @ 2024-12-13 16:52 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: Eli Zaretskii, 74833

[-- Attachment #1: Type: text/plain, Size: 3165 bytes --]

Try experimenting with alternative terminals such as
https://wezfurlong.org/wezterm/ which I've used and where I remap all of
the keys to pass through to Emacs vs. letting the terminal application
abscond with functions like Command-C. I can share my wezterm configuration
off line if you're interested. I still remain mostly GUI on macOS but
occasionally use the terminal, and especially useful for running Emacs via
ssh on a remote computer (vs. tramp).

On Fri, Dec 13, 2024 at 11:42 AM Ship Mints <shipmints@gmail.com> wrote:

> What you describe is normal behavior, even if it appears confusing. It's
> an "impedance mismatch" between terminal.app and being in a "curses"
> window. Terminal doesn't "see" selected text and hence Command-C is
> disabled. This is the opposite for a basic shell where terminal sees the
> text because it controls selection. You can see this by pulling down the
> Edit menu and seeing Copy grayed out. As far as how xterm-mouse-mode
> interferes with Command-C I'd have to disable it myself and see what's
> going on. Not sure how much value that adds, though. If you enable xclip,
> you'll get what you want being inside Emacs, after all, using M-w gets your
> selected text copied to the pasteboard.
>
> On Fri, Dec 13, 2024 at 11:35 AM Filipp Gunbin <fgunbin@fastmail.fm>
> wrote:
>
>> On 13/12/2024 09:21 +0200, Eli Zaretskii wrote:
>>
>> >> From: Ship Mints <shipmints@gmail.com>
>> >> Date: Thu, 12 Dec 2024 15:31:00 -0500
>> >> Cc: fgunbin@fastmail.fm, 74833@debbugs.gnu.org
>> >>
>> >> I have xterm-mouse-mode enabled when in tty mode on macOS and it does
>> work for clicking/selecting but
>> >> this is independent of integrating the kill ring with the pasteboard.
>> I am unaware of how to test the
>> >> completeness of the xterm mouse protocol support, however.
>> >
>> > 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.
>>
>> That's why I filed this bug - because previous behavior was not ideal
>> but working, and now only paste works.
>>
>> Maybe we should just avoid enabling xterm-mouse-mode in Terminal.app.
>> Maybe functionality of xclip should be in core.
>>
>

[-- Attachment #2: Type: text/html, Size: 4287 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-13 16:49             ` Eli Zaretskii
@ 2024-12-13 20:32               ` Filipp Gunbin
  2024-12-13 20:54                 ` Ship Mints
  0 siblings, 1 reply; 19+ messages in thread
From: Filipp Gunbin @ 2024-12-13 20:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74833, shipmints

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





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-13 16:52               ` Ship Mints
@ 2024-12-13 20:46                 ` Filipp Gunbin
  0 siblings, 0 replies; 19+ messages in thread
From: Filipp Gunbin @ 2024-12-13 20:46 UTC (permalink / raw)
  To: Ship Mints; +Cc: Eli Zaretskii, 74833

On 13/12/2024 11:52 -0500, Ship Mints wrote:

> Try experimenting with alternative terminals such as
> https://wezfurlong.org/wezterm/ which I've used and where I remap all of
> the keys to pass through to Emacs vs. letting the terminal application
> abscond with functions like Command-C. I can share my wezterm configuration
> off line if you're interested. I still remain mostly GUI on macOS but
> occasionally use the terminal, and especially useful for running Emacs via
> ssh on a remote computer (vs. tramp).

Thank you for the tips!  I'm certainly fine with xterm-mouse-mode off,
this bug is rather to let people know that the _default_ behavior
worsened, in default macOS terminal.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled
  2024-12-13 20:32               ` Filipp Gunbin
@ 2024-12-13 20:54                 ` Ship Mints
  0 siblings, 0 replies; 19+ messages in thread
From: Ship Mints @ 2024-12-13 20:54 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: Eli Zaretskii, 74833

[-- Attachment #1: Type: text/plain, Size: 2649 bytes --]

I'm afraid to say that TERM indicates terminfo support, not whether
terminal.app provides full xterm compatibility which I believe it doesn't,
at least not without manual modifications to the key maps and I can't speak
to other xterm features. This will require some experimentation. Give
xterm.el a try and see how it goes. I would not load that by default
without conformance testing of some kind. I suppose it would already have
been by now if it was known to work.

Take a look at this page
https://dotat.at/@/2020-12-12-terminal-app-xterm-compatibiity.html someone
did some work in this regard. I might give some of this a try myself one
day.

On Fri, Dec 13, 2024 at 3:32 PM Filipp Gunbin <fgunbin@fastmail.fm> wrote:

> 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
>

[-- Attachment #2: Type: text/html, Size: 3742 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2024-12-13 20:54 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 17:54 bug#74833: 31.0.50; Copy to OS clipboard doesn't work in macOS Terminal.app with xterm-mouse-mode enabled Filipp Gunbin
2024-12-12 18:08 ` Ship Mints
2024-12-12 18:18   ` Filipp Gunbin
2024-12-12 18:20     ` Ship Mints
2024-12-12 19:15 ` Eli Zaretskii
2024-12-12 19:18   ` Ship Mints
2024-12-12 19:32     ` Eli Zaretskii
2024-12-12 20:07       ` Gerd Möllmann
2024-12-12 20:31       ` Ship Mints
2024-12-13  7:21         ` Eli Zaretskii
2024-12-13 14:46           ` Ship Mints
2024-12-13 16:35           ` Filipp Gunbin
2024-12-13 16:42             ` Ship Mints
2024-12-13 16:52               ` Ship Mints
2024-12-13 20:46                 ` Filipp Gunbin
2024-12-13 16:49             ` Eli Zaretskii
2024-12-13 20:32               ` Filipp Gunbin
2024-12-13 20:54                 ` Ship Mints
2024-12-12 19:55   ` Gerd Möllmann

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).