Monday, September 28, 2015

Re: remote_read() never returns

On Sunday, September 27, 2015 at 8:46:34 PM UTC-5, David Fishburn wrote:
> VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 23 2015 09:51:11)
> MS-Windows 32-bit GUI version with OLE support
> Included patches: 1-873
>
>
> I am making a remote_send() call to a different server and I really want to get the value returned from the function I am calling.
>
>
> The help indicates I can do this:
> :h remote_send()
>
>
>
>
>
> call remote_send( g:remotediff_servername, ":call MyFunc( '".a:filename1."' )\<CR>", "firstfile_bufnr" )
> call remote_read(firstfile_bufnr) 
> echomsg "remote_read:" firstfile_bufnr
>
>
>
>
> Problem is, we never get to the echomsg statement.  Vim just hangs forever.
>
>
> If I don't use the remote_read() everything functions correctly, except I do not get the return code from the function I called.
>
>
> Anyone have any suggestions?
>

The way I'm reading the help, I have two suggestions:

It looks like for this to work, your "MyFunc" function will need to call server2client() internally. The value you send with this function should be received by your remote_read call. Is this how you MyFunc works, or are you expecting to receive the return value instead? Note that the :call command does not have any mechanism to get the return value.

My second suggestion is that remote_read *returns* the value received from the server, but it looks like you're trying to access the return value by reading the firstfile_bufnr variable. This is incorrect. In your example, firstfile_bufnr is updated by remote_send to store a server ID, it is used *as* a server ID in your remote_read call, but the variable name and its presence in your echomsg command indicate you expect it to be something else (presumably the return value of MyFunc).

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment