emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: callback functions in Emacs


From: Michael Albinus
Subject: Re: callback functions in Emacs
Date: Wed, 05 Sep 2007 17:18:06 +0200
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (hpux)

"Davis Herring" <address@hidden> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]