Alban Crequy wrote:

> I would like to have a support for D-Bus [1] in vim, and then be able
> to write vim plug-ins that use the vim D-Bus connection to communicate
> with external applications. My goal [2] is to be able to control the vim
> buffer from other applications to enable collaboration features (as
> Gobby does) between different editors (vim, emacs) using the same
> D-Bus protocol.
> 
> I don't know the vim code, but with help from the #vim IRC channel, I
> wrote a vim plug-in in python [3] that fires a D-Bus signal each time
> the vim buffer is changed. It seems possible to inform external
> applications of each change of the vim buffer.
> 
> I want also my plug-in to receive to D-Bus methods, so that external
> applications can change the content of the vim buffer. However, I am
> unable to do that with my plug-in because of the way the D-Bus
> connection is implemented in my plug-in. 
> 
> The D-Bus connection is an Unix socket. When vim fires a signal from the
> plug-in, some data is sent through the socket to the dbus-daemon
> process. But to receive D-Bus signal, the socket file descriptor must
> be added somehow in the vim main loop in order to call a function to
> read on the socket and I have no idea how to do that from a vim plug-in
> in Python. It may not be possible to do it from a Python plug-in without
> modifying the vim code.
> 
> It seems that this "mainloop" problem is not specific to D-Bus but other
> projects has the same problem:
> 
> - Clewn [4]: GDB support in vim. Clewn is an external program but need
> a patch in vim to work.
> - Slim-Vim [5]: Vim interface to SLIME, the project is abandoned. It
> needed a way to add a socket connection.
> - Eclim [6]: Eclipse integration in Vim: Vim instances communicate with
> Eclipse through the Eclim interface.
> - Vim client-server communication [7]
> 
> The problem is, there is a lot of different projects, I don't know where
> to start looking :)
> 
> Can you explain me the place in the vim code where the main loop is
> implemented? Should I look at some of the above projects or other ones?

There are two ways.  Netbeans hooks itself into the GUI input.  See
src/netbeans.c.  The other way is adding something to the select() call.
This is in RealWaitForChar() in os_unix.c.  Search for FEAT_MOUSE_GPM to
see an example.

-- 
You can be stopped by the police for biking over 65 miles per hour.
You are not allowed to walk across a street on your hands.
                [real standing laws in Connecticut, United States of America]

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui