From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Jan D." Newsgroups: gmane.emacs.devel Subject: Re: signal handling bogosities Date: Tue, 31 Dec 2002 17:54:36 +0100 (MET) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200212311750.gBVHoo0U025254@stubby.bodenonline.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1041353754 8872 80.91.224.249 (31 Dec 2002 16:55:54 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 31 Dec 2002 16:55:54 +0000 (UTC) Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18TPgH-0002Iw-00 for ; Tue, 31 Dec 2002 17:55:53 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18TPhV-0003nN-00 for ; Tue, 31 Dec 2002 17:57:09 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18TPgj-0003BU-03 for emacs-devel@quimby.gnus.org; Tue, 31 Dec 2002 11:56:21 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18TPgJ-0002ze-00 for emacs-devel@gnu.org; Tue, 31 Dec 2002 11:55:55 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18TPfo-0001xj-00 for emacs-devel@gnu.org; Tue, 31 Dec 2002 11:55:26 -0500 Original-Received: from stubby.bodenonline.com ([193.201.16.94]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18TPfd-0001YO-00 for emacs-devel@gnu.org; Tue, 31 Dec 2002 11:55:13 -0500 Original-Received: from accessno42.bodenonline.com (IDENT:root@accessno42.bodenonline.com [193.201.16.44])gBVHoo0U025254 for ; Tue, 31 Dec 2002 18:50:51 +0100 Original-To: emacs-devel@gnu.org In-Reply-To: from "Richard Stallman" at dec 26, 2002 02:49:29 X-Mailer: ELM [version 2.5 PL0pre8] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:10386 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10386 > > FWIW, I believe Xemacs uses a home-brewed event loop. which allows > it to support such things as opening both X and text-terminal frames > in the same Emacs instance, for example. very nifty. > > The XEmacs developers told me 10 years ago that XEmacs used an > inside-out structure, where Xt implements the event loop and calls > Emacs to handle each events. That unnatural structure makes it > impossible to write your own loop in Lisp. I rejected it. One could argue that for a GUI application the XEmacs approach is the natural loop :-) > They told me that it was impossible to handle Xt with a natural > structure, where the event loop uses the toolkit as a subroutine, but > we did it. (Actually I think Paul Reilly did it.) But not without problems as this discussion shows. Also, there are some code just to overcome these problems (timers for example) that feels like a kludge. I see that Emacs does some polling when running under X, there is a timeout for about half a second for each select call. I don't know why, but I guess it is related. This makes it hard to debug events, if nothing else. I read a paper about event loops on the net some time ago (no URL, sorry), and it described the problems of integrating several event models. Say you have some GUI toolkit, perhaps CORBA, some database access toolkit, and a custom event loop for your application. Trying to integrate these into one loop is never easy since all these toolkits usually assume you run their event loop and nothing else. Some are more integration- friendly than others (X/Xt is very friendly, GTK is very unfriendly). Threads to the rescue, but that is not always that easy either. > I will not accept that unnatural structure now, any more than I did 10 > years ago. However, I won't reject all possible changes in the event > loop. It might be useful to rewrite the event loop in Lisp (keeping > its present natural structure). I haven't looked at this in detail, but it seems to me that a lot could be gained if Emacs could wait for events in some toolkit specific routine, like XtAppNextEvent for Xt. Now it looks to me it does a select for the X connection file descriptor. The difference is that if we use a toolkit routine, timers, signal handlers and idle callbacks and possible other stuff the toolkit wants to do, gets handled normally. Has this been considered? It doesn't solve the redrawing while executing lisp, but helps a bit. Jan D.