[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: suspend-tty

From: Stefan Monnier
Subject: Re: suspend-tty
Date: Fri, 10 Oct 2008 23:32:59 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>> In the case of server.er, I believe it's used as follows:
>> When emacsclient receives a SIGSTOP (aka C-z), it sends a message to the
>> Emacs process, which then calls suspend-tty, which basically puts the
>> corresponding terminal object in a special state that prevents Emacs from
>> reading&writing to/from that tty.  Then the Emacs process sends
>> a message to emacsclient to suspend itself (so the shell from which it
>> was started is told that the suspend has taken place).

> And the purpose of all this jumping through the hoops is...?  If it's
> just for suspending emacsclient, why isn't it enough to let the normal
> SIGSTOP handler do its thing, i.e. suspend emacsclient itself? why is
> there a need to suspend the Emacs terminal as well?  What am I
> missing?

Because it's the Emacs process that's using the tty, not `emacsclient'.
So, when we hit C-z, emacsclient has to tell Emacs to stop using the tty
otherwise the shell and Emacs will end up both using it at the same
time, leading to corrupted display, unusable input that sometimes goes
to one sometimes to the other process, ...

>> It was probably free for use by other programs, but no other program was
>> told to use it.
> So the only way to use that terminal is for some other program to open
> it for I/O?

Or, the shell from which Emacs was started (assuming it was started
from a shell) could use it, but you'd have to tell it that it's

>> For me, the docstring seems to say "clearly" what the function does.
> It says clearly what the function does (remember that I also read the
> sources, so I knew what it does even without the doc string), but what
> I was looking for was something else: who would need to call it, and
> why.  IOW, I looked for a simple use-case for this API.

Emacsclient is the most obvious use case.  Can't think of any other.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]