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: DBus events processing (was: read-event and unexpected buffer changes) Date: Fri, 24 May 2013 11:48:05 -0400 Message-ID: References: <87zjwigzg6.fsf@dex.adm.naquadah.org> <8761y836v4.fsf@gmx.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1369410539 23372 80.91.229.3 (24 May 2013 15:48:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 May 2013 15:48:59 +0000 (UTC) Cc: emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 24 17:48:59 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UfuEk-00041t-8S for ged-emacs-devel@m.gmane.org; Fri, 24 May 2013 17:48:58 +0200 Original-Received: from localhost ([::1]:47052 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfuEj-0002gi-Ow for ged-emacs-devel@m.gmane.org; Fri, 24 May 2013 11:48:57 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfuE3-0001OT-Gw for emacs-devel@gnu.org; Fri, 24 May 2013 11:48:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfuDy-0006zS-So for emacs-devel@gnu.org; Fri, 24 May 2013 11:48:15 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:40828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfuDy-0006yP-Q8 for emacs-devel@gnu.org; Fri, 24 May 2013 11:48:10 -0400 Original-Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r4OFm53s007229; Fri, 24 May 2013 11:48:05 -0400 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 3DC4CB414F; Fri, 24 May 2013 11:48:05 -0400 (EDT) In-Reply-To: <8761y836v4.fsf@gmx.de> (Michael Albinus's message of "Fri, 24 May 2013 14:22:23 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4589=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4589> : streams <966567> : uri <1429031> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:159769 Archived-At: >>> (let ((event (let (unread-command-events) (read-event nil nil 0.1)))) >>> (when (and event (not (ignore-errors (dbus-check-event event)))) >>> (setq unread-command-events >>> (append unread-command-events (list event))))))) >> Why not use sit-for? > Ah, right! Thinking about this problem some more, I think the problem is that dbus events should be processed during sit-for, just like process filters are run there. DBus events come concurrently with keyboard&mouse events and then we forcefully linearize them into the event queue, which is not right in your case where you want to process the dbus events before the user's key presses. So we should change the C code for our dbus interface. It could either be shoehorned into the way process filters/sentinels are handled, or we could add a secondary event queue for "asynchronous events". Stefan