From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: suspend-tty Date: Fri, 10 Oct 2008 23:32:59 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1223696013 30458 80.91.229.12 (11 Oct 2008 03:33:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 11 Oct 2008 03:33:33 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 11 05:34:30 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KoVFN-0003jX-VZ for ged-emacs-devel@m.gmane.org; Sat, 11 Oct 2008 05:34:30 +0200 Original-Received: from localhost ([127.0.0.1]:33856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KoVEJ-00068K-Sb for ged-emacs-devel@m.gmane.org; Fri, 10 Oct 2008 23:33:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KoVEF-00065u-Ag for emacs-devel@gnu.org; Fri, 10 Oct 2008 23:33:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KoVEE-00064D-09 for emacs-devel@gnu.org; Fri, 10 Oct 2008 23:33:19 -0400 Original-Received: from [199.232.76.173] (port=33398 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KoVED-000644-NV for emacs-devel@gnu.org; Fri, 10 Oct 2008 23:33:17 -0400 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]:43507 helo=ironport2-out.teksavvy.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KoVEC-0001e6-4H; Fri, 10 Oct 2008 23:33:16 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsEAPa770jO+IL0/2dsb2JhbACBcrongWyBCQ X-IronPort-AV: E=Sophos;i="4.33,392,1220241600"; d="scan'208";a="28297466" Original-Received: from 206-248-130-244.dsl.teksavvy.com (HELO pastel.home) ([206.248.130.244]) by ironport2-out.teksavvy.com with ESMTP; 10 Oct 2008 23:32:59 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 957877F84; Fri, 10 Oct 2008 23:32:59 -0400 (EDT) In-Reply-To: (Eli Zaretskii's message of "Fri, 10 Oct 2008 20:39:00 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:104473 Archived-At: >> 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 available. >> 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. Stefan