From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: how to wait for a process to be alive? Date: Fri, 22 Oct 2010 14:18:06 +0200 Message-ID: <87vd4upgjl.fsf@gmx.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1287749905 20320 80.91.229.12 (22 Oct 2010 12:18:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 22 Oct 2010 12:18:25 +0000 (UTC) Cc: Emacs developers To: joakim@verona.se Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 22 14:18:24 2010 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.69) (envelope-from ) id 1P9GZj-0001SU-ES for ged-emacs-devel@m.gmane.org; Fri, 22 Oct 2010 14:18:23 +0200 Original-Received: from localhost ([127.0.0.1]:51541 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P9GZi-0000ej-CI for ged-emacs-devel@m.gmane.org; Fri, 22 Oct 2010 08:18:22 -0400 Original-Received: from [140.186.70.92] (port=37466 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P9GZc-0000eZ-DI for emacs-devel@gnu.org; Fri, 22 Oct 2010 08:18:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P9GZb-0006wK-8n for emacs-devel@gnu.org; Fri, 22 Oct 2010 08:18:16 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:43954 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1P9GZa-0006vX-TN for emacs-devel@gnu.org; Fri, 22 Oct 2010 08:18:15 -0400 Original-Received: (qmail invoked by alias); 22 Oct 2010 12:18:08 -0000 Original-Received: from p4FC19562.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [79.193.149.98] by mail.gmx.net (mp063) with SMTP; 22 Oct 2010 14:18:08 +0200 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1+QTyMb31yQA2PzNVquZNZr4if3XkEngWZVMBONvS ZLMjKpT8k35HIV User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.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:131985 Archived-At: joakim@verona.se writes: > I'm working on a mode to integrate Inkscape and Emacs. So far its only > rudimentary. > > I want to start Inkscape from Emacs, with code looking like this: > > | (defun inkscape-start () > | (interactive) > | (if (not (dbus-ping :session "org.inkscape" 100)) dbus-ping has the side effect to start a service, if it doesn't run yet, and if it has provided a service file (located under /usr/share/dbus-1/services). This would already be a good way to start the process, if such a service file exists. If you want to check only, whether Inkscape is running, you could call (dbus-get-name-owner :session "org.inkscape") > I suppose the sleep-for is interupted by some kind of event, but I cant > figure out which, or how to do this properly. The best would be for > Inkscape to send Emacs some kind of event rather than Emacs polling > Inkscape, but I'm not sure how to do that either. Register for the D-Bus signal org.freedesktop.DBus.NameOwnerChanged. You will get signals like this: signal sender=org.freedesktop.DBus -> dest=(null destination) serial=8 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged string ":1.97" string "" string ":1.97" With the same dbus-get-name-owner as above call you can check, whether Inkscape is already started. Best regards, Michael.