unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: suspend-tty
Date: Fri, 10 Oct 2008 13:15:46 -0400	[thread overview]
Message-ID: <jwvk5cgmlj6.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <uprm8iih5.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 10 Oct 2008 17:21:26 +0200")

> Does anyone know what is the purpose of suspend-tty?  (Please don't
> tell "to stop I/O from/to a terminal", since that just repeats the
> name of the function.)  IOW, under what circumstances would a Lisp
> program want to do that, and what could be then done with the terminal
> which Emacs ``suspended''?

[ The blind leading the blind... ]

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

So suspend-tty just stops Emacs from using that tty (and tries to
restore its mode to default settings) so that some other application can
take control of it.

> I tried invoking suspend-tty on a GNU/Linux machine, and the terminal
> just got hang, the only thing I could do is abort Emacs.  (If I had
> another tty open in the same session, I understand I could resume-tty,
> but that doesn't really answers my question.)  I thought suspend-tty
> would leave the terminal free for use by other programs, but it sounds
> like I misunderstood?

It was probably free for use by other programs, but no other program was
told to use it.  E.g. the shell from which you started Emacs was not
told, so it was still waiting for Emacs to suspend itself or to exit.

> The only non-trivial user of suspend-tty is server.el, but the new
> functionality that uses it is completely undocumented, both in the
> code, in NEWS and in the manuals, and the semantics of using this API
> evaded me.

For me, the docstring seems to say "clearly" what the function does.
The name is slightly misleading, tho, because it applies to a terminal
rather than to a tty.  Of course, it only applies to terminals of tty
kind, but a given tty can have several terminals associated with it
(e.g. if you do "emacsclient -t; C-z; emacsclient -t").

So, do you understand what it does, now?  If so, how would you suggest
we change the docstring to make it more clear for you as well?


        Stefan




  reply	other threads:[~2008-10-10 17:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-10 15:21 suspend-tty Eli Zaretskii
2008-10-10 17:15 ` Stefan Monnier [this message]
2008-10-10 18:39   ` suspend-tty Eli Zaretskii
2008-10-11  3:32     ` suspend-tty Stefan Monnier
2008-10-10 18:39   ` suspend-tty Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvk5cgmlj6.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).