Re: Autocommand-Event for Clipboard-Changed

2006-10-03 Thread Charles E Campbell Jr

Yegappan Lakshmanan wrote:

Are you referring to a sample code similar to the xcmdsrv_client.c 
file under

the $VIM/tools directory? This sample code shows how to send commands
to a remote Vim from a C program in Unix systems running X-Windows.
A similar sample code for MS-Windows is needed.


Looks like Bram is a precognitive!  Yep, that's what I meant.

Regards,
Chip Campbell



Re: Autocommand-Event for Clipboard-Changed

2006-10-03 Thread Yegappan Lakshmanan

Hi Charles,

On 10/3/06, Charles E Campbell Jr <[EMAIL PROTECTED]> wrote:

Bram Moolenaar wrote:

>Suresh Govindachar wrote:
>
>
>>Is it possible to add an autocommand-event for "Clipboard Changed"?
>>
>>
>
>Not really.  This is not something that happens inside Vim.  Polling for
>changes in the system is not really something I would like to add to Vim.
>
>
Bram -- would you be willing to give out a bit of code that will send a
remote message to vim?
Some function, perhaps SendCmd2Vim("string").  That way it'll be simple
for folks to make their
own external programs to send a command to vim via the already available
remote vim stuff.

Presumably the code snippet wouldn't be a Part of Vim itself; maybe
something for vim.sf.net?

Just an idea...
Chip Campbell



Are you referring to a sample code similar to the xcmdsrv_client.c file under
the $VIM/tools directory? This sample code shows how to send commands
to a remote Vim from a C program in Unix systems running X-Windows.
A similar sample code for MS-Windows is needed.

- Yegappan


Re: Autocommand-Event for Clipboard-Changed

2006-10-03 Thread Charles E Campbell Jr

Yakov Lerner wrote:


What's wrong with doing system("vim --remote-xxx yyy zzz") in
any programming language ?


Seems grossly inefficient: with this call one is bringing up both a new 
shell and a new vim,
although the new vim probably doesn't do too much other than send the 
command.


Regards,
Chip Campbell



Re: Autocommand-Event for Clipboard-Changed

2006-10-03 Thread Yakov Lerner

On 10/3/06, Charles E Campbell Jr <[EMAIL PROTECTED]> wrote:

Bram Moolenaar wrote:

>Suresh Govindachar wrote:
>
>
>>Is it possible to add an autocommand-event for "Clipboard Changed"?
>>
>>
>
>Not really.  This is not something that happens inside Vim.  Polling for
>changes in the system is not really something I would like to add to Vim.
>
>
Bram -- would you be willing to give out a bit of code that will send a
remote message to vim?
Some function, perhaps SendCmd2Vim("string").  That way it'll be simple
for folks to make their
own external programs to send a command to vim via the already available
remote vim stuff.


Charles,
What's wrong with doing system("vim --remote-xxx yyy zzz") in
any programming language ?

Yakov


Re: Autocommand-Event for Clipboard-Changed

2006-10-03 Thread Bram Moolenaar

Charles Campbell wrote:

> Bram Moolenaar wrote:
> 
> >Suresh Govindachar wrote:
> >
> >>Is it possible to add an autocommand-event for "Clipboard Changed"?
> >
> >Not really.  This is not something that happens inside Vim.  Polling for
> >changes in the system is not really something I would like to add to Vim.
>
> Bram -- would you be willing to give out a bit of code that will send a 
> remote message to vim?
> Some function, perhaps SendCmd2Vim("string").  That way it'll be simple 
> for folks to make their own external programs to send a command to vim
> via the already available remote vim stuff.
> 
> Presumably the code snippet wouldn't be a Part of Vim itself; maybe 
> something for vim.sf.net?

I don't know what you mean with "would you be willing".
src/if_xcmdsrv.c contains info for writing a C program.  os_mswin.c also
has some code that can be used for Win32.  It's not easy, of course.
I can't remember seeing a program that actually does this.

-- 
Engineers will go without food and hygiene for days to solve a problem.
(Other times just because they forgot.)
(Scott Adams - The Dilbert principle)

 /// 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///


Re: Autocommand-Event for Clipboard-Changed

2006-10-03 Thread A.J.Mechelynck

Charles E Campbell Jr wrote:

Bram Moolenaar wrote:


Suresh Govindachar wrote:
 


Is it possible to add an autocommand-event for "Clipboard Changed"?
  


Not really.  This is not something that happens inside Vim.  Polling for
changes in the system is not really something I would like to add to Vim.
 

Bram -- would you be willing to give out a bit of code that will send a 
remote message to vim?
Some function, perhaps SendCmd2Vim("string").  That way it'll be simple 
for folks to make their
own external programs to send a command to vim via the already available 
remote vim stuff.


Presumably the code snippet wouldn't be a Part of Vim itself; maybe 
something for vim.sf.net?


Just an idea...
Chip Campbell




:call remote_send({server}, {string}[, {idvar}])

:let x = remote_expr({server}, {string}[, {idvar}])

etc.

For other programs: there are two protocols used: Windows and X11. You may 
want to dig into the Vim source to see how it does it. The server code (or the 
X11 server code?) is in src/if_xcmdsrv.c. The client code may be in eval.c or 
something -- look for Vim functions with names starting "remote_" (or C 
functions with names starting "f_remote_"). In the source I have here 
(7.0.114) there is an #ifdef FEAT_CLIENTSERVER at eval_c line 13051.



Best regards,
Tony.


Re: Autocommand-Event for Clipboard-Changed

2006-10-03 Thread Charles E Campbell Jr

Bram Moolenaar wrote:


Suresh Govindachar wrote:
 


Is it possible to add an autocommand-event for "Clipboard Changed"?
   



Not really.  This is not something that happens inside Vim.  Polling for
changes in the system is not really something I would like to add to Vim.
 

Bram -- would you be willing to give out a bit of code that will send a 
remote message to vim?
Some function, perhaps SendCmd2Vim("string").  That way it'll be simple 
for folks to make their
own external programs to send a command to vim via the already available 
remote vim stuff.


Presumably the code snippet wouldn't be a Part of Vim itself; maybe 
something for vim.sf.net?


Just an idea...
Chip Campbell



Re: Autocommand-Event for Clipboard-Changed

2006-10-02 Thread Nikolai Weibull

On 10/2/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote:


Suresh Govindachar wrote:

> Is it possible to add an autocommand-event for "Clipboard Changed"?

Not really.  This is not something that happens inside Vim.  Polling for
changes in the system is not really something I would like to add to Vim.


The windows api provides an easy way to be notified of such changes.
It's just a WM_ message that you hook into by calling some function
that I can't remember the name of.

X11 and Gdk has something similar as well, but I've never used it.

I have no idea if there's a good way to do it on other systems,
though.  (I'm guessing that OS X has something like this as well.)

 nikolai


Re: Autocommand-Event for Clipboard-Changed

2006-10-02 Thread Bram Moolenaar

Suresh Govindachar wrote:

> Is it possible to add an autocommand-event for "Clipboard Changed"?

Not really.  This is not something that happens inside Vim.  Polling for
changes in the system is not really something I would like to add to Vim.

-- 
Managers are like cats in a litter box.  They instinctively shuffle things
around to conceal what they've done.
(Scott Adams - The Dilbert principle)

 /// 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///


Autocommand-Event for Clipboard-Changed

2006-10-01 Thread Suresh Govindachar
  Is it possible to add an autocommand-event for "Clipboard Changed"?

  Thanks,
 
  --Suresh