Subject: bug#70519: 30.0.50; Device for Emacs terminal I/O

From: Eli Zaretskii <[email-masked]>
Date: Sat, 04 May 2024 19:19:12 +0300

> From: Helmut Eller <[email-masked]>
> Cc: [email-masked]
> Date: Sat, 04 May 2024 17:47:00 +0200
> 
> On Sat, May 04 2024, Eli Zaretskii wrote:
> 
> > I attempted to fix this now that way on the master branch.  Would you
> > mind testing whether it does what you wanted?  If the current master
> > somehow doesn't do what you wanted, I'd appreciate a recipe for
> > reproducing the problematic behavior, so I could investigate.
> 
> It's much better now.  However, there is still something I would like to
> be different.  I basically do this:
> 
> 1) Start an xterm: xterm -e sh -c 'tty; exec sleep inf'
>    This displays /dev/pts/12 and waits.  Let's call this terminal A.
> 
> 2) Start Emacs in another terminal, let's call it terminal B, start
>    Emacs with: emacs -t /dev/pts/12
> 
>    This prints "Using /dev/pts/12" and Emacs displays stuff in terminal
>    A.  Which is what one would expect.
> 
> 3) Now when I press C-c in terminal B, I see ^C.  This is not what I
>    expect. I would expect that Emacs is interrupted and exits the same
>    way a GUI Emacs exits when pressing C-c.

Thanks for testing.  I'm not sure about item 3, I guess it has
something to do with the controlling terminal and how signals are
delivered depending on that.  AFAIU, the --terminal option causes
Emacs to close its original stdin, so Ctrl-C does not send SIGINT to
Emacs.  But I'm nowhere near being an expert on that.  Paul, can you
please comment on that?

In any case, does this allow you to do what you originally wanted,
i.e. debug a -nw session of Emacs without mixing GDB I/O and Emacs
I/O?