Monday, September 28, 2015

Re: remote_read() never returns

...
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).


I just read through :h remote.txt, where it explains more on this topic and you are right.

I can use remote_peek() to check if there is something ready to come back and remote_read() if there is.
The client2server() function is used server side, which remote_peek() is checking for.

Thanks for the response Ben, much appreciated.

David


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