summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-02-16 21:03:07 +0100
committerBram Moolenaar <Bram@vim.org>2016-02-16 21:03:07 +0100
commit910b8aac5dc4693c4508b7acd2cef0bbfac04242 (patch)
treecb88e93372558043a8a0050d6ff5fa6704e74f02 /runtime
parent7d63f624603ebeae336d4c504f82ab3da3481f46 (diff)
patch 7.4.1341v7.4.1341
Problem: It's difficult to add more arguments to ch_sendraw() and ch_sendexpr(). Solution: Make the third option a dictionary.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/channel.txt18
-rw-r--r--runtime/doc/eval.txt34
2 files changed, 29 insertions, 23 deletions
diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt
index 7938087b1b..a52c739ad7 100644
--- a/runtime/doc/channel.txt
+++ b/runtime/doc/channel.txt
@@ -1,4 +1,4 @@
-*channel.txt* For Vim version 7.4. Last change: 2016 Feb 15
+*channel.txt* For Vim version 7.4. Last change: 2016 Feb 16
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -117,7 +117,7 @@ Use |ch_status()| to see if the channel could be opened.
"mode" can be: *channel-mode*
"json" - Use JSON, see below; most convenient way. Default.
- "js" - Use JavaScript encoding, more efficient than JSON.
+ "js" - Use JS (JavaScript) encoding, more efficient than JSON.
"nl" - Use messages that end in a NL character
"raw" - Use raw messages
@@ -188,11 +188,11 @@ If there is an error reading or writing a channel it will be closed.
==============================================================================
4. Using a JSON or JS channel *channel-use*
-If {mode} is "json" then a message can be sent synchronously like this: >
+If mode is JSON then a message can be sent synchronously like this: >
let response = ch_sendexpr(channel, {expr})
This awaits a response from the other side.
-When {mode} is "js" this works the same, except that the messages use
+When mode is JS this works the same, except that the messages use
JavaScript encoding. See |js_encode()| for the difference.
To send a message, without handling a response: >
@@ -242,7 +242,7 @@ is then completely responsible for correct encoding and decoding.
==============================================================================
5. Channel commands *channel-commands*
-With a "json" channel the process can send commands to Vim that will be
+With a JSON channel the process can send commands to Vim that will be
handled by Vim internally, it does not require a handler for the channel.
Possible commands are: *E903* *E904* *E905*
@@ -316,14 +316,15 @@ Example:
==============================================================================
6. Using a RAW or NL channel *channel-raw*
-If {mode} is "raw" then a message can be send like this: >
+If mode is RAW or NL then a message can be send like this: >
let response = ch_sendraw(channel, {string})
+
The {string} is sent as-is. The response will be what can be read from the
channel right away. Since Vim doesn't know how to recognize the end of the
message you need to take care of it yourself. The timeout applies for reading
the first byte, after that it will not wait for anything more.
-If {mode} is "nl" you can send a message in a similar way. You are expected
+If mode is "nl" you can send a message in a similar way. You are expected
to put in the NL after each message. Thus you can also send several messages
ending in a NL at once. The response will be the text up to and including the
first NL. This can also be just the NL for an empty response.
@@ -450,6 +451,7 @@ The {options} argument in job_start() is a dictionary. All entries are
optional. The same options can be used with job_setoptions(job, {options}).
TODO: *job-out-cb*
+"callback": handler
"out-cb": handler Callback for when there is something to read on
stdout.
TODO: *job-err-cb*
@@ -484,7 +486,7 @@ TODO: *job-out-io*
"out-buffer": "name" buffer to append to
TODO: *job-err-io*
-"err-io": "out" same as stdout (default)
+"err-io": "out" same type as stdout (default)
"err-io": "null" disconnect stderr
"err-io": "pipe" stderr is connected to the channel
"err-io": "file" stderr writes to a file
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 6feb137a2f..9ec893f744 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.4. Last change: 2016 Feb 13
+*eval.txt* For Vim version 7.4. Last change: 2016 Feb 16
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1821,9 +1821,9 @@ ch_close( {handle}) none close a channel
ch_logfile( {fname} [, {mode}]) none start logging channel activity
ch_open( {address} [, {argdict})] Number open a channel to {address}
ch_readraw( {handle}) String read from channel {handle}
-ch_sendexpr( {handle}, {expr} [, {callback}])
+ch_sendexpr( {handle}, {expr} [, {options}])
any send {expr} over JSON channel {handle}
-ch_sendraw( {handle}, {string} [, {callback}])
+ch_sendraw( {handle}, {string} [, {options}])
any send {string} over raw channel {handle}
ch_status( {handle}) String status of channel {handle}
changenr() Number current change number
@@ -2725,28 +2725,32 @@ ch_readraw({handle}) *ch_readraw()*
within that time an empty string is returned.
TODO: depends on channel mode.
-ch_sendexpr({handle}, {expr} [, {callback}]) *ch_sendexpr()*
+ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()*
Send {expr} over channel {handle}. The {expr} is encoded
according to the type of channel. The function cannot be used
with a raw channel. See |channel-use|. *E912*
- When {callback} is given returns immediately. Without
- {callback} waits for a response and returns the decoded
- expression. When there is an error or timeout returns an
- empty string.
+ {options} must be a Dictionary.
+ When "callback" is a Funcref or the name of a function,
+ ch_sendexpr() returns immediately. The callback is invoked
+ when the response is received. See |channel-callback|.
+
+ Without "callback" ch_sendexpr() waits for a response and
+ returns the decoded expression. When there is an error or
+ timeout it returns an empty string.
- When {callback} is zero no response is expected.
- Otherwise {callback} must be a Funcref or the name of a
- function. It is called when the response is received. See
- |channel-callback|.
+ When "callback" is zero no response is expected.
{only available when compiled with the |+channel| feature}
-ch_sendraw({handle}, {string} [, {callback}]) *ch_sendraw()*
+ch_sendraw({handle}, {string} [, {options}]) *ch_sendraw()*
Send {string} over channel {handle}.
Works like |ch_sendexpr()|, but does not encode the request or
decode the response. The caller is responsible for the
- correct contents. See |channel-use|.
+ correct contents. Also does not add a newline for a channel
+ in NL mode, the caller must do that. The NL in the response
+ is removed.
+ See |channel-use|.
{only available when compiled with the |+channel| feature}
@@ -7274,7 +7278,7 @@ listcmds Compiled with commands for the buffer list |:files|
and the argument list |arglist|.
localmap Compiled with local mappings and abbr. |:map-local|
lua Compiled with Lua interface |Lua|.
-mac Macintosh version of Vim.
+mac Any Macintosh version of Vim.
macunix Compiled for OS X, with darwin
osx Compiled for OS X, with or without darwin
menu Compiled with support for |:menu|.