Skip to content

Commit 132598e

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 31b6e28 + 29fd038 commit 132598e

8 files changed

Lines changed: 217 additions & 137 deletions

File tree

runtime/doc/repeat.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*repeat.txt* For Vim version 7.4. Last change: 2016 Mar 07
1+
*repeat.txt* For Vim version 7.4. Last change: 2016 Mar 09
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -441,24 +441,24 @@ The directory name "foo" is arbitrary, you can pick anything you like.
441441

442442
You would now have these files under ~/.vim:
443443
pack/foo/README.txt
444-
pack/foo/ever/foobar/plugin/foo.vim
445-
pack/foo/ever/foobar/syntax/some.vim
444+
pack/foo/start/foobar/plugin/foo.vim
445+
pack/foo/start/foobar/syntax/some.vim
446446
pack/foo/opt/foodebug/plugin/debugger.vim
447447

448448
When Vim starts up, after processing your .vimrc, it scans all directories in
449-
'packpath' for plugins under the "pack/*/ever" directory and loads them. The
449+
'packpath' for plugins under the "pack/*/start" directory and loads them. The
450450
directory is added to 'runtimepath'.
451451

452-
In the example Vim will find "pack/foo/ever/foobar/plugin/foo.vim" and adds
453-
"~/.vim/pack/foo/ever/foobar" to 'runtimepath'.
452+
In the example Vim will find "pack/foo/start/foobar/plugin/foo.vim" and adds
453+
"~/.vim/pack/foo/start/foobar" to 'runtimepath'.
454454

455455
If the "foobar" plugin kicks in and sets the 'filetype' to "some", Vim will
456456
find the syntax/some.vim file, because its directory is in 'runtimepath'.
457457

458458
Vim will also load ftdetect files, if there are any.
459459

460460
Note that the files under "pack/foo/opt" or not loaded automatically, only the
461-
ones under "pack/foo/ever". See |pack-add| below for how the "opt" directory
461+
ones under "pack/foo/start". See |pack-add| below for how the "opt" directory
462462
is used.
463463

464464
Loading packages will not happen if loading plugins is disabled, see
@@ -469,13 +469,13 @@ Using a single plugin and loading it automatically ~
469469

470470
If you don't have a package but a single plugin, you need to create the extra
471471
directory level:
472-
% mkdir -p ~/.vim/pack/foo/ever/foobar
473-
% cd ~/.vim/pack/foo/ever/foobar
472+
% mkdir -p ~/.vim/pack/foo/start/foobar
473+
% cd ~/.vim/pack/foo/start/foobar
474474
% unzip /tmp/someplugin.zip
475475

476476
You would now have these files:
477-
pack/foo/ever/foobar/plugin/foo.vim
478-
pack/foo/ever/foobar/syntax/some.vim
477+
pack/foo/start/foobar/plugin/foo.vim
478+
pack/foo/start/foobar/syntax/some.vim
479479

480480
From here it works like above.
481481

src/channel.c

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -647,9 +647,8 @@ channel_open(
647647
*/
648648
while (TRUE)
649649
{
650-
#ifndef WIN32
651-
long elapsed_msec = 0;
652-
#endif
650+
long elapsed_msec = 0;
651+
int waitnow;
653652

654653
if (sd >= 0)
655654
sock_close(sd);
@@ -707,7 +706,7 @@ channel_open(
707706
}
708707

709708
/* If connect() didn't finish then try using select() to wait for the
710-
* connection to be made. */
709+
* connection to be made. For Win32 always use select() to wait. */
711710
#ifndef WIN32
712711
if (errno != ECONNREFUSED)
713712
#endif
@@ -721,19 +720,22 @@ channel_open(
721720
struct timeval start_tv;
722721
struct timeval end_tv;
723722
#endif
723+
/* Limit the waittime to 50 msec. If it doesn't work within this
724+
* time we close the socket and try creating it again. */
725+
waitnow = waittime > 50 ? 50 : waittime;
724726

725727
FD_ZERO(&rfds);
726728
FD_SET(sd, &rfds);
727729
FD_ZERO(&wfds);
728730
FD_SET(sd, &wfds);
729731

730-
tv.tv_sec = waittime / 1000;
731-
tv.tv_usec = (waittime % 1000) * 1000;
732+
tv.tv_sec = waitnow / 1000;
733+
tv.tv_usec = (waitnow % 1000) * 1000;
732734
#ifndef WIN32
733735
gettimeofday(&start_tv, NULL);
734736
#endif
735737
ch_logn(channel,
736-
"Waiting for connection (waittime %d msec)...", waittime);
738+
"Waiting for connection (waiting %d msec)...", waitnow);
737739
ret = select((int)sd + 1, &rfds, &wfds, NULL, &tv);
738740

739741
if (ret < 0)
@@ -748,10 +750,16 @@ channel_open(
748750
}
749751

750752
#ifdef WIN32
751-
/* On Win32: select() is expected to work and wait for up to the
752-
* waittime for the socket to be open. */
753+
/* On Win32: select() is expected to work and wait for up to
754+
* "waitnow" msec for the socket to be open. */
753755
if (FD_ISSET(sd, &wfds))
754756
break;
757+
elapsed_msec = waitnow;
758+
if (waittime > 1 && elapsed_msec < waittime)
759+
{
760+
waittime -= elapsed_msec;
761+
continue;
762+
}
755763
#else
756764
/* On Linux-like systems: See socket(7) for the behavior
757765
* After putting the socket in non-blocking mode, connect() will
@@ -797,17 +805,20 @@ channel_open(
797805
{
798806
/* The port isn't ready but we also didn't get an error.
799807
* This happens when the server didn't open the socket
800-
* yet. Wait a bit and try again. */
801-
mch_delay(waittime < 50 ? (long)waittime : 50L, TRUE);
802-
ui_breakcheck();
808+
* yet. Select() may return early, wait until the remaining
809+
* "waitnow" and try again. */
810+
waitnow -= elapsed_msec;
811+
waittime -= elapsed_msec;
812+
if (waitnow > 0)
813+
{
814+
mch_delay((long)waitnow, TRUE);
815+
ui_breakcheck();
816+
waittime -= waitnow;
817+
}
803818
if (!got_int)
804819
{
805-
/* reduce the waittime by the elapsed time and the 50
806-
* msec delay (or a bit more) */
807-
waittime -= elapsed_msec;
808-
if (waittime > 50)
809-
waittime -= 50;
810-
else
820+
if (waittime <= 0)
821+
/* give it one more try */
811822
waittime = 1;
812823
continue;
813824
}
@@ -995,7 +1006,11 @@ channel_set_options(channel_T *channel, jobopt_T *opt)
9951006
/* writing output to a buffer. Default mode is NL. */
9961007
if (!(opt->jo_set & JO_OUT_MODE))
9971008
channel->ch_part[PART_OUT].ch_mode = MODE_NL;
998-
channel->ch_part[PART_OUT].ch_buffer =
1009+
if (opt->jo_set & JO_OUT_BUF)
1010+
channel->ch_part[PART_OUT].ch_buffer =
1011+
buflist_findnr(opt->jo_io_buf[PART_OUT]);
1012+
else
1013+
channel->ch_part[PART_OUT].ch_buffer =
9991014
find_buffer(opt->jo_io_name[PART_OUT], FALSE);
10001015
ch_logs(channel, "writing out to buffer '%s'",
10011016
(char *)channel->ch_part[PART_OUT].ch_buffer->b_ffname);
@@ -1011,6 +1026,9 @@ channel_set_options(channel_T *channel, jobopt_T *opt)
10111026
if (opt->jo_io[PART_ERR] == JIO_OUT)
10121027
channel->ch_part[PART_ERR].ch_buffer =
10131028
channel->ch_part[PART_OUT].ch_buffer;
1029+
else if (opt->jo_set & JO_ERR_BUF)
1030+
channel->ch_part[PART_ERR].ch_buffer =
1031+
buflist_findnr(opt->jo_io_buf[PART_ERR]);
10141032
else
10151033
channel->ch_part[PART_ERR].ch_buffer =
10161034
find_buffer(opt->jo_io_name[PART_ERR], TRUE);

src/eval.c

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10119,6 +10119,27 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
1011910119
opt->jo_io_name[part] =
1012010120
get_tv_string_buf_chk(item, opt->jo_io_name_buf[part]);
1012110121
}
10122+
else if (STRCMP(hi->hi_key, "in-buf") == 0
10123+
|| STRCMP(hi->hi_key, "out-buf") == 0
10124+
|| STRCMP(hi->hi_key, "err-buf") == 0)
10125+
{
10126+
part = part_from_char(*hi->hi_key);
10127+
10128+
if (!(supported & JO_OUT_IO))
10129+
break;
10130+
opt->jo_set |= JO_OUT_BUF << (part - PART_OUT);
10131+
opt->jo_io_buf[part] = get_tv_number(item);
10132+
if (opt->jo_io_buf[part] <= 0)
10133+
{
10134+
EMSG2(_(e_invarg2), get_tv_string(item));
10135+
return FAIL;
10136+
}
10137+
if (buflist_findnr(opt->jo_io_buf[part]) == NULL)
10138+
{
10139+
EMSGN(_(e_nobufnr), (long)opt->jo_io_buf[part]);
10140+
return FAIL;
10141+
}
10142+
}
1012210143
else if (STRCMP(hi->hi_key, "in-top") == 0
1012310144
|| STRCMP(hi->hi_key, "in-bot") == 0)
1012410145
{
@@ -15175,21 +15196,36 @@ f_job_start(typval_T *argvars, typval_T *rettv)
1517515196

1517615197
if ((opt.jo_set & JO_IN_IO) && opt.jo_io[PART_IN] == JIO_BUFFER)
1517715198
{
15178-
buf_T *buf;
15199+
buf_T *buf = NULL;
1517915200

1518015201
/* check that we can find the buffer before starting the job */
15181-
if (!(opt.jo_set & JO_IN_NAME))
15202+
if (opt.jo_set & JO_IN_BUF)
1518215203
{
15183-
EMSG(_("E915: in-io buffer requires in-name to be set"));
15184-
return;
15204+
buf = buflist_findnr(opt.jo_io_buf[PART_IN]);
15205+
if (buf == NULL)
15206+
EMSGN(_(e_nobufnr), (long)opt.jo_io_buf[PART_IN]);
1518515207
}
15186-
buf = buflist_find_by_name(opt.jo_io_name[PART_IN], FALSE);
15208+
else if (!(opt.jo_set & JO_IN_NAME))
15209+
{
15210+
EMSG(_("E915: in-io buffer requires in-buf or in-name to be set"));
15211+
}
15212+
else
15213+
buf = buflist_find_by_name(opt.jo_io_name[PART_IN], FALSE);
1518715214
if (buf == NULL)
1518815215
return;
1518915216
if (buf->b_ml.ml_mfp == NULL)
1519015217
{
15191-
EMSG2(_("E918: buffer must be loaded: %s"),
15192-
opt.jo_io_name[PART_IN]);
15218+
char_u buf[NUMBUFLEN];
15219+
char_u *s;
15220+
15221+
if (opt.jo_set & JO_IN_BUF)
15222+
{
15223+
sprintf((char *)buf, "%d", opt.jo_io_buf[PART_IN]);
15224+
s = buf;
15225+
}
15226+
else
15227+
s = opt.jo_io_name[PART_IN];
15228+
EMSG2(_("E918: buffer must be loaded: %s"), s);
1519315229
return;
1519415230
}
1519515231
job->jv_in_buf = buf;

src/ex_cmds2.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3191,8 +3191,8 @@ add_pack_plugin(char_u *fname, void *cookie)
31913191
}
31923192

31933193
/* now we have:
3194-
* rtp/pack/name/ever/name
3195-
* p4 p3 p2 p1
3194+
* rtp/pack/name/start/name
3195+
* p4 p3 p2 p1
31963196
*
31973197
* find the part up to "pack" in 'runtimepath' */
31983198
c = *p4;
@@ -3268,7 +3268,7 @@ add_pack_plugin(char_u *fname, void *cookie)
32683268
void
32693269
source_packages()
32703270
{
3271-
do_in_path(p_pp, (char_u *)"pack/*/ever/*", DIP_ALL + DIP_DIR,
3271+
do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR,
32723272
add_pack_plugin, p_pp);
32733273
}
32743274

0 commit comments

Comments
 (0)