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: callback functions in Emacs Date: Wed, 05 Sep 2007 17:18:06 +0200 Message-ID: References: <87642qmb0g.fsf@gmx.de> <873axtz9ng.fsf@gnuvola.org> <60290.128.165.123.18.1189002611.squirrel@webmail.lanl.gov> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1189005517 13194 80.91.229.12 (5 Sep 2007 15:18:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 5 Sep 2007 15:18:37 +0000 (UTC) Cc: emacs-devel@gnu.org, Thien-Thi Nguyen , rms@gnu.org To: herring@lanl.gov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 05 17:18:36 2007 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 1ISweE-00059L-Tq for ged-emacs-devel@m.gmane.org; Wed, 05 Sep 2007 17:18:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ISweD-0005ew-5N for ged-emacs-devel@m.gmane.org; Wed, 05 Sep 2007 11:18:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ISwe8-0005cj-O3 for emacs-devel@gnu.org; Wed, 05 Sep 2007 11:18:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ISwe6-0005Zc-SQ for emacs-devel@gnu.org; Wed, 05 Sep 2007 11:18:24 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ISwe6-0005ZP-J3 for emacs-devel@gnu.org; Wed, 05 Sep 2007 11:18:22 -0400 Original-Received: from mailrelay1.alcatel.de ([194.113.59.95]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ISwdz-0001xx-St; Wed, 05 Sep 2007 11:18:16 -0400 Original-Received: from slbhab.alcatel.de (slbhab.bln.sel.alcatel.de [149.204.63.218]) by mailrelay1.alcatel.de (8.13.4/8.13.4/ICT) with ESMTP id l85FHbON000300; Wed, 5 Sep 2007 17:17:38 +0200 In-Reply-To: <60290.128.165.123.18.1189002611.squirrel@webmail.lanl.gov> (Davis Herring's message of "Wed, 5 Sep 2007 07:30:11 -0700 (PDT)") User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (hpux) X-Scanned-By: MIMEDefang 2.51 on 149.204.45.72 X-Detected-Kernel: Linux 2.4-2.6 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:77867 Archived-At: "Davis Herring" writes: > Perhaps I misunderstand D-Bus (having only glanced at its front page), but > I believe that messages can only be delivered to processes (that already > exist). We'd have to have some sort of emacsclientserver (perhaps within > Emacs) that listened for them and translated them into emacsclient > invocations. Of course, if such a server is in Emacs, it prevents having > another program to customize, but then it might as well do what the OP > suggests and handle the messages itself. Emacs client can play its role, but for D-Bus it isn't necessary I believe. When Emacs is started, it registers during the initialization phase at the D-Bus for a given service. Then an application can send a message directly to this service, and Emacs is in. A concept of D-Bus (I haven't mentioned yet) is that it even can start an application for a service if it doesn't find a registered one. Example (I assume you run Linux): Save the following lines as file /usr/share/dbus-1/services/emacs.service [D-BUS Service] Name=org.gnu.emacs.TextEditor Exec=/usr/local/bin/emacs Send from a shell the command # dbus-send --session --print-reply --dest=org.gnu.emacs.TextEditor /org/gnu/emacs/TextEditor org.gnu.emacs.TextEditor The command is just an emulation of a message any application can send to the session bus. Then a fresh Emacs will be started. D-Bus waits for a given time that this Emacs registers the service org.gnu.emacs.TextEditor, and would provide the message then. You will see that it doesn't work in this case, there is a timeout because Emacs doesn't register in time (yet). No need for Emacs client when using D-Bus. > Davis Best regards, Michael. PS: the implementation of callback functions via special-event-map is already running, but it needs some more tuning. Thanks again for the hint.