Skip to content

Commit 9787680

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 349f039 + 0f526f5 commit 9787680

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+828
-1901
lines changed

Filelist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ SRC_DOS_UNIX = \
262262
src/if_python3.c \
263263
src/if_py_both.h \
264264
src/if_ruby.c \
265-
src/if_sniff.h \
266265
src/if_tcl.c \
267266
src/proto/if_cscope.pro \
268267
src/proto/if_lua.pro \
@@ -455,7 +454,6 @@ SRC_EXTRA = \
455454
$(SRC_VMS) \
456455
README_os390.txt \
457456
src/Make_mint.mak \
458-
src/if_sniff.c \
459457
src/infplist.xml \
460458
src/link.390 \
461459
src/os_beos.c \

runtime/doc/channel.txt

Lines changed: 62 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*channel.txt* For Vim version 7.4. Last change: 2016 Feb 23
1+
*channel.txt* For Vim version 7.4. Last change: 2016 Feb 27
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -74,7 +74,7 @@ In T1 you should see:
7474
=== socket opened === ~
7575

7676
You can now send a message to the server: >
77-
echo ch_sendexpr(channel, 'hello!')
77+
echo ch_evalexpr(channel, 'hello!')
7878
7979
The message is received in T1 and a response is sent back to Vim.
8080
You can see the raw messages in T1. What Vim sends is:
@@ -101,7 +101,7 @@ Instead of giving a callback with every send call, it can also be specified
101101
when opening the channel: >
102102
call ch_close(channel)
103103
let channel = ch_open('localhost:8765', {'callback': "MyHandler"})
104-
call ch_sendexpr(channel, 'hello!', {'callback': 0})
104+
call ch_sendexpr(channel, 'hello!')
105105
106106
==============================================================================
107107
3. Opening a channel *channel-open*
@@ -130,6 +130,8 @@ Use |ch_status()| to see if the channel could be opened.
130130
overwritten. Therefore set "mode" first and the part specific
131131
mode later.
132132

133+
Note: when writing to a file or buffer NL mode is always used.
134+
133135
*channel-callback*
134136
"callback" A function that is called when a message is received that is
135137
not handled otherwise. It gets two arguments: the channel
@@ -169,7 +171,7 @@ Use |ch_status()| to see if the channel could be opened.
169171
msec at least.
170172

171173
"timeout" The time to wait for a request when blocking, E.g. when using
172-
ch_sendexpr(). In milliseconds. The default is 2000 (2
174+
ch_evalexpr(). In milliseconds. The default is 2000 (2
173175
seconds).
174176
*out-timeout* *err-timeout*
175177
"out-timeout" Timeout for stdout. Only when using pipes.
@@ -198,6 +200,7 @@ Once done with the channel, disconnect it like this: >
198200
When a socket is used this will close the socket for both directions. When
199201
pipes are used (stdin/stdout/stderr) they are all closed. This might not be
200202
what you want! Stopping the job with job_stop() might be better.
203+
All readahead is discarded, callbacks will no longer be invoked.
201204

202205
When the channel can't be opened you will get an error message. There is a
203206
difference between MS-Windows and Unix: On Unix when the port doesn't exist
@@ -211,15 +214,15 @@ If there is an error reading or writing a channel it will be closed.
211214
4. Using a JSON or JS channel *channel-use*
212215

213216
If mode is JSON then a message can be sent synchronously like this: >
214-
let response = ch_sendexpr(channel, {expr})
217+
let response = ch_evalexpr(channel, {expr})
215218
This awaits a response from the other side.
216219

217220
When mode is JS this works the same, except that the messages use
218221
JavaScript encoding. See |js_encode()| for the difference.
219222

220223
To send a message, without handling a response or letting the channel callback
221224
handle the response: >
222-
call ch_sendexpr(channel, {expr}, {'callback': 0})
225+
call ch_sendexpr(channel, {expr})
223226
224227
To send a message and letting the response handled by a specific function,
225228
asynchronously: >
@@ -260,8 +263,9 @@ On read error or ch_close(), when using a socket, the string "DETACH" is sent,
260263
if still possible. The channel will then be inactive. For a JSON and JS mode
261264
channel quotes are used around DETACH, otherwise there are no quotes.
262265

263-
It is also possible to use ch_sendraw() on a JSON or JS channel. The caller
264-
is then completely responsible for correct encoding and decoding.
266+
It is also possible to use ch_sendraw() and ch_evalraw() on a JSON or JS
267+
channel. The caller is then completely responsible for correct encoding and
268+
decoding.
265269

266270
==============================================================================
267271
5. Channel commands *channel-commands*
@@ -327,7 +331,7 @@ It will send back the result of the expression:
327331
[-2, "last line"] ~
328332
The format is:
329333
[{number}, {result}]
330-
*E915*
334+
331335
Here {number} is the same as what was in the request. Use a negative number
332336
to avoid confusion with message that Vim sends. Use a different number on
333337
every request to be able to match the request with the response.
@@ -360,7 +364,7 @@ Leave out the fourth argument if no response is to be sent:
360364
6. Using a RAW or NL channel *channel-raw*
361365

362366
If mode is RAW or NL then a message can be send like this: >
363-
let response = ch_sendraw(channel, {string})
367+
let response = ch_evalraw(channel, {string})
364368
365369
The {string} is sent as-is. The response will be what can be read from the
366370
channel right away. Since Vim doesn't know how to recognize the end of the
@@ -374,18 +378,18 @@ first NL. This can also be just the NL for an empty response.
374378
If no NL was read before the channel timeout an empty string is returned.
375379

376380
To send a message, without expecting a response: >
377-
call ch_sendraw(channel, {string}, 0)
381+
call ch_sendraw(channel, {string})
378382
The process can send back a response, the channel handler will be called with
379383
it.
380384

381385
To send a message and letting the response handled by a specific function,
382386
asynchronously: >
383-
call ch_sendraw(channel, {string}, {callback})
387+
call ch_sendraw(channel, {string}, {'callback': 'MyHandler'})
384388
385389
This {string} can also be JSON, use |json_encode()| to create it and
386390
|json_decode()| to handle a received JSON message.
387391

388-
It is not possible to use |ch_sendexpr()| on a raw channel.
392+
It is not possible to use |ch_evalexpr()| or |ch_sendexpr()| on a raw channel.
389393

390394
==============================================================================
391395
7. More channel functions *channel-more*
@@ -397,7 +401,7 @@ are:
397401
"closed" The channel was closed.
398402

399403
TODO:
400-
To objain the job associated with a channel: ch_getjob(channel)
404+
To obtain the job associated with a channel: ch_getjob(channel)
401405

402406
To read one message from a channel: >
403407
let output = ch_read(channel)
@@ -444,14 +448,17 @@ If you want to handle both stderr and stdout with one handler use the
444448
"callback" option: >
445449
let job = job_start(command, {"callback": "MyHandler"})
446450
447-
You can send a message to the command with ch_sendraw(). If the channel is in
448-
JSON or JS mode you can use ch_sendexpr().
451+
You can send a message to the command with ch_evalraw(). If the channel is in
452+
JSON or JS mode you can use ch_evalexpr().
449453

450454
There are several options you can use, see |job-options|.
455+
For example, to start a job and write its output in buffer "dummy": >
456+
let logjob = job_start("tail -f /tmp/log",
457+
\ {'out-io': 'buffer', 'out-name': 'dummy'})
458+
sbuf dummy
451459
452460
TODO:
453461
To run a job and read its output once it is done: >
454-
455462
let job = job_start({command}, {'exit-cb': 'MyHandler'})
456463
func MyHandler(job, status)
457464
let channel = job_getchannel()
@@ -508,7 +515,7 @@ See |job_setoptions()| and |ch_setoptions()|.
508515
*job-err-cb*
509516
"err-cb": handler Callback for when there is something to read on
510517
stderr.
511-
TODO: *job-close-cb*
518+
*job-close-cb*
512519
"close-cb": handler Callback for when the channel is closed. Same as
513520
"close-cb" on ch_open().
514521
*job-exit-cb*
@@ -527,28 +534,47 @@ TODO: *job-term*
527534
"term": "open" Start a terminal and connect the job
528535
stdin/stdout/stderr to it.
529536

530-
TODO: *job-in-io*
531-
"in-io": "null" disconnect stdin
537+
*job-in-io*
538+
"in-io": "null" disconnect stdin TODO
532539
"in-io": "pipe" stdin is connected to the channel (default)
533-
"in-io": "file" stdin reads from a file
534-
"in-file": "/path/file" the file to read from
540+
"in-io": "file" stdin reads from a file TODO
541+
"in-io": "buffer" stdin reads from a buffer TODO
542+
"in-name": "/path/file" the name of he file or buffer to read from
543+
"in-buf": number the number of the buffer to read from TODO
535544

536-
TODO: *job-out-io*
537-
"out-io": "null" disconnect stdout
545+
*job-out-io*
546+
"out-io": "null" disconnect stdout TODO
538547
"out-io": "pipe" stdout is connected to the channel (default)
539-
"out-io": "file" stdout writes to a file
540-
"out-file": "/path/file" the file to write to
548+
"out-io": "file" stdout writes to a file TODO
541549
"out-io": "buffer" stdout appends to a buffer
542-
"out-buffer": "name" buffer to append to
543-
544-
TODO: *job-err-io*
545-
"err-io": "out" same type as stdout (default)
546-
"err-io": "null" disconnect stderr
547-
"err-io": "pipe" stderr is connected to the channel
548-
"err-io": "file" stderr writes to a file
549-
"err-file": "/path/file" the file to write to
550-
"err-io": "buffer" stderr appends to a buffer
551-
"err-buffer": "name" buffer to append to
550+
"out-name": "/path/file" the name of the file or buffer to write to
551+
"out-buf": number the number of the buffer to write to TODO
552+
553+
*job-err-io*
554+
"err-io": "out" same as stdout TODO
555+
"err-io": "null" disconnect stderr TODO
556+
"err-io": "pipe" stderr is connected to the channel (default)
557+
"err-io": "file" stderr writes to a file TODO
558+
"err-io": "buffer" stderr appends to a buffer TODO
559+
"err-name": "/path/file" the name of the file or buffer to write to
560+
"err-buf": number the number of the buffer to write to TODO
561+
562+
When the IO mode is "buffer" and there is a callback, the text is appended to
563+
the buffer before invoking the callback.
564+
565+
The name of the buffer is compared the full name of existing buffers. If
566+
there is a match that buffer is used. Otherwise a new buffer is created.
567+
Use an empty name to always create a new buffer. |ch_getbufnr()| can then be
568+
used to get the buffer number.
569+
570+
For a new buffer 'buftype' is set to "nofile" and 'bufhidden' to "hide". If
571+
you prefer other settings, create the buffer first and pass the buffer number.
572+
573+
When the buffer written to is displayed in a window and the cursor is in the
574+
first column of the last line, the cursor will be moved to the newly added
575+
line and the window is scrolled up to show the cursor if needed.
576+
577+
Undo is synced for every added line.
552578

553579
==============================================================================
554580
11. Controlling a job *job-control*

runtime/doc/eval.txt

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 7.4. Last change: 2016 Feb 23
1+
*eval.txt* For Vim version 7.4. Last change: 2016 Feb 27
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1818,6 +1818,11 @@ call( {func}, {arglist} [, {dict}])
18181818
any call {func} with arguments {arglist}
18191819
ceil( {expr}) Float round {expr} up
18201820
ch_close( {channel}) none close {channel}
1821+
ch_evalexpr( {channel}, {expr} [, {options}])
1822+
any evaluate {expr} on JSON {channel}
1823+
ch_evalraw( {channel}, {string} [, {options}])
1824+
any evaluate {string} on raw {channel}
1825+
ch_getbufnr( {channel}, {what}) Number get buffer number for {channel}/{what}
18211826
ch_getjob( {channel}) Job get the Job of {channel}
18221827
ch_log( {msg} [, {channel}]) none write {msg} in the channel log file
18231828
ch_logfile( {fname} [, {mode}]) none start logging channel activity
@@ -2692,6 +2697,38 @@ ch_close({channel}) *ch_close()*
26922697
Close {channel}. See |channel-close|.
26932698
{only available when compiled with the |+channel| feature}
26942699

2700+
ch_evalexpr({channel}, {expr} [, {options}]) *ch_evalexpr()*
2701+
Send {expr} over {channel}. The {expr} is encoded
2702+
according to the type of channel. The function cannot be used
2703+
with a raw channel. See |channel-use|.
2704+
*E917*
2705+
{options} must be a Dictionary. It must not have a "callback"
2706+
entry.
2707+
2708+
ch_evalexpr() waits for a response and returns the decoded
2709+
expression. When there is an error or timeout it returns an
2710+
empty string.
2711+
2712+
{only available when compiled with the |+channel| feature}
2713+
2714+
ch_evalraw({channel}, {string} [, {options}]) *ch_evalraw()*
2715+
Send {string} over {channel}.
2716+
Works like |ch_evalexpr()|, but does not encode the request or
2717+
decode the response. The caller is responsible for the
2718+
correct contents. Also does not add a newline for a channel
2719+
in NL mode, the caller must do that. The NL in the response
2720+
is removed.
2721+
See |channel-use|.
2722+
2723+
{only available when compiled with the |+channel| feature}
2724+
2725+
ch_getbufnr({channel}, {what}) *ch_getbufnr()*
2726+
Get the buffer number that {channel} is using for {what}.
2727+
{what} can be "err" for stderr, "out" for stdout or empty for
2728+
socket output.
2729+
Returns -1 when there is no buffer.
2730+
{only available when compiled with the |+channel| feature}
2731+
26952732
ch_getjob({channel}) *ch_getjob()*
26962733
Get the Job associated with {channel}.
26972734
If there is no job calling |job_status()| on the returned Job
@@ -2767,18 +2804,13 @@ ch_readraw({channel} [, {options}]) *ch_readraw()*
27672804
ch_sendexpr({channel}, {expr} [, {options}]) *ch_sendexpr()*
27682805
Send {expr} over {channel}. The {expr} is encoded
27692806
according to the type of channel. The function cannot be used
2770-
with a raw channel. See |channel-use|. *E912*
2771-
2772-
{options} must be a Dictionary.
2773-
When "callback" is a Funcref or the name of a function,
2774-
ch_sendexpr() returns immediately. The callback is invoked
2775-
when the response is received. See |channel-callback|.
2776-
2777-
Without "callback" ch_sendexpr() waits for a response and
2778-
returns the decoded expression. When there is an error or
2779-
timeout it returns an empty string.
2807+
with a raw channel. See |channel-use|. *E912*
27802808

2781-
When "callback" is zero no response is expected.
2809+
{options} must be a Dictionary. The "callback" item is a
2810+
Funcref or the name of a function it is invoked when the
2811+
response is received. See |channel-callback|.
2812+
Without "callback" the channel handler is invoked, otherwise
2813+
any received message is dropped.
27822814

27832815
{only available when compiled with the |+channel| feature}
27842816

@@ -4561,6 +4593,8 @@ json_encode({expr}) *json_encode()*
45614593
Vim values are converted as follows:
45624594
Number decimal number
45634595
Float floating point number
4596+
Float nan "NaN"
4597+
Float inf "Infinity"
45644598
String in double quotes (possibly null)
45654599
Funcref not possible, error
45664600
List as an array (possibly null); when
@@ -4571,13 +4605,9 @@ json_encode({expr}) *json_encode()*
45714605
v:true "true"
45724606
v:none "null"
45734607
v:null "null"
4574-
Note that using v:none is permitted, although the JSON
4575-
standard does not allow empty items. This can be useful for
4576-
omitting items in an array:
4577-
[0,,,,,5] ~
4578-
This is much more efficient than:
4579-
[0,null,null,null,null,5] ~
4580-
But a strict JSON parser will not accept it.
4608+
Note that NaN and Infinity are passed on as values. This is
4609+
missing in the JSON standard, but several implementations do
4610+
allow it. If not then you will get an error.
45814611

45824612
keys({dict}) *keys()*
45834613
Return a |List| with all the keys of {dict}. The |List| is in
@@ -7396,7 +7426,6 @@ scrollbind Compiled with 'scrollbind' support.
73967426
showcmd Compiled with 'showcmd' support.
73977427
signs Compiled with |:sign| support.
73987428
smartindent Compiled with 'smartindent' support.
7399-
sniff Compiled with SNiFF interface support.
74007429
spell Compiled with spell checking support |spell|.
74017430
startuptime Compiled with |--startuptime| support.
74027431
statusline Compiled with support for 'statusline', 'rulerformat'

runtime/doc/help.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*help.txt* For Vim version 7.4. Last change: 2016 Feb 22
1+
*help.txt* For Vim version 7.4. Last change: 2016 Feb 27
22

33
VIM - main help file
44
k
@@ -165,7 +165,6 @@ Interfaces ~
165165
|if_mzsch.txt| MzScheme interface
166166
|if_perl.txt| Perl interface
167167
|if_pyth.txt| Python interface
168-
|if_sniff.txt| SNiFF+ interface
169168
|if_tcl.txt| Tcl interface
170169
|if_ole.txt| OLE automation interface for Win32
171170
|if_ruby.txt| Ruby interface

0 commit comments

Comments
 (0)