Skip to content

Commit fa4076a

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 66dc685 + a772ec5 commit fa4076a

21 files changed

Lines changed: 587 additions & 191 deletions

runtime/doc/eval.txt

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 7.4. Last change: 2016 Aug 06
1+
*eval.txt* For Vim version 7.4. Last change: 2016 Aug 07
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1969,7 +1969,7 @@ assert_exception({error} [, {msg}]) none assert {error} is in v:exception
19691969
assert_fails({cmd} [, {error}]) none assert {cmd} fails
19701970
assert_false({actual} [, {msg}]) none assert {actual} is false
19711971
assert_inrange({lower}, {upper}, {actual} [, {msg}])
1972-
none assert {actual} is inside the range
1972+
none assert {actual} is inside the range
19731973
assert_match({pat}, {text} [, {msg}]) none assert {pat} matches {text}
19741974
assert_notequal({exp}, {act} [, {msg}]) none assert {exp} is not equal {act}
19751975
assert_notmatch({pat}, {text} [, {msg}]) none assert {pat} not matches {text}
@@ -2340,9 +2340,11 @@ test_null_partial() Funcref null value for testing
23402340
test_null_string() String null value for testing
23412341
test_settime({expr}) none set current time for testing
23422342
timer_info([{id}]) List information about timers
2343+
timer_pause({id}, {pause}) none pause or unpause a timer
23432344
timer_start({time}, {callback} [, {options}])
23442345
Number create a timer
23452346
timer_stop({timer}) none stop a timer
2347+
timer_stopall() none stop all timers
23462348
tolower({expr}) String the String {expr} switched to lowercase
23472349
toupper({expr}) String the String {expr} switched to uppercase
23482350
tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr}
@@ -7555,8 +7557,26 @@ timer_info([{id}])
75557557
"time" time the timer was started with
75567558
"remaining" time until the timer fires
75577559
"repeat" number of times the timer will still fire;
7558-
-1 means forever
7560+
-1 means forever
75597561
"callback" the callback
7562+
"paused" 1 if the timer is paused, 0 otherwise
7563+
7564+
{only available when compiled with the |+timers| feature}
7565+
7566+
timer_pause({timer}, {paused}) *timer_pause()*
7567+
Pause or unpause a timer. A paused timer does not invoke its
7568+
callback, while the time it would is not changed. Unpausing a
7569+
timer may cause the callback to be invoked almost immediately
7570+
if enough time has passed.
7571+
7572+
Pausing a timer is useful to avoid the callback to be called
7573+
for a short time.
7574+
7575+
If {paused} evaluates to a non-zero Number or a non-empty
7576+
String, then the timer is paused, otherwise it is unpaused.
7577+
See |non-zero-arg|.
7578+
7579+
{only available when compiled with the |+timers| feature}
75607580

75617581
*timer_start()*
75627582
timer_start({time}, {callback} [, {options}])
@@ -7583,13 +7603,23 @@ timer_start({time}, {callback} [, {options}])
75837603
\ {'repeat': 3})
75847604
< This will invoke MyHandler() three times at 500 msec
75857605
intervals.
7606+
75867607
{only available when compiled with the |+timers| feature}
75877608

75887609
timer_stop({timer}) *timer_stop()*
75897610
Stop a timer. The timer callback will no longer be invoked.
75907611
{timer} is an ID returned by timer_start(), thus it must be a
75917612
Number. If {timer} does not exist there is no error.
75927613

7614+
{only available when compiled with the |+timers| feature}
7615+
7616+
timer_stopall() *timer_stopall()*
7617+
Stop all timers. The timer callbacks will no longer be
7618+
invoked. Useful if some timers is misbehaving. If there are
7619+
no timers there is no error.
7620+
7621+
{only available when compiled with the |+timers| feature}
7622+
75937623
tolower({expr}) *tolower()*
75947624
The result is a copy of the String given, with all uppercase
75957625
characters turned into lowercase (just like applying |gu| to

src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2048,7 +2048,6 @@ test1 \
20482048
test_mapping \
20492049
test_marks \
20502050
test_nested_function \
2051-
test_options \
20522051
test_search_mbyte \
20532052
test_signs \
20542053
test_tagcase \
@@ -2118,6 +2117,7 @@ test_arglist \
21182117
test_menu \
21192118
test_messages \
21202119
test_netbeans \
2120+
test_options \
21212121
test_packadd \
21222122
test_partial \
21232123
test_perl \

src/evalfunc.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,10 @@ static void f_tanh(typval_T *argvars, typval_T *rettv);
397397
#endif
398398
#ifdef FEAT_TIMERS
399399
static void f_timer_info(typval_T *argvars, typval_T *rettv);
400+
static void f_timer_pause(typval_T *argvars, typval_T *rettv);
400401
static void f_timer_start(typval_T *argvars, typval_T *rettv);
401402
static void f_timer_stop(typval_T *argvars, typval_T *rettv);
403+
static void f_timer_stopall(typval_T *argvars, typval_T *rettv);
402404
#endif
403405
static void f_tolower(typval_T *argvars, typval_T *rettv);
404406
static void f_toupper(typval_T *argvars, typval_T *rettv);
@@ -817,8 +819,10 @@ static struct fst
817819
{"test_settime", 1, 1, f_test_settime},
818820
#ifdef FEAT_TIMERS
819821
{"timer_info", 0, 1, f_timer_info},
822+
{"timer_pause", 2, 2, f_timer_pause},
820823
{"timer_start", 2, 3, f_timer_start},
821824
{"timer_stop", 1, 1, f_timer_stop},
825+
{"timer_stopall", 0, 0, f_timer_stopall},
822826
#endif
823827
{"tolower", 1, 1, f_tolower},
824828
{"toupper", 1, 1, f_toupper},
@@ -12014,6 +12018,25 @@ f_timer_info(typval_T *argvars, typval_T *rettv)
1201412018
add_timer_info_all(rettv);
1201512019
}
1201612020

12021+
/*
12022+
* "timer_pause(timer, paused)" function
12023+
*/
12024+
static void
12025+
f_timer_pause(typval_T *argvars, typval_T *rettv UNUSED)
12026+
{
12027+
timer_T *timer = NULL;
12028+
int paused = (int)get_tv_number(&argvars[1]);
12029+
12030+
if (argvars[0].v_type != VAR_NUMBER)
12031+
EMSG(_(e_number_exp));
12032+
else
12033+
{
12034+
timer = find_timer((int)get_tv_number(&argvars[0]));
12035+
if (timer != NULL)
12036+
timer->tr_paused = paused;
12037+
}
12038+
}
12039+
1201712040
/*
1201812041
* "timer_start(time, callback [, options])" function
1201912042
*/
@@ -12075,6 +12098,15 @@ f_timer_stop(typval_T *argvars, typval_T *rettv UNUSED)
1207512098
if (timer != NULL)
1207612099
stop_timer(timer);
1207712100
}
12101+
12102+
/*
12103+
* "timer_stopall()" function
12104+
*/
12105+
static void
12106+
f_timer_stopall(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
12107+
{
12108+
stop_all_timers();
12109+
}
1207812110
#endif
1207912111

1208012112
/*

src/ex_cmds2.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,8 @@ check_due_timer(void)
11891189
next_due = -1;
11901190
for (timer = first_timer; timer != NULL; timer = timer->tr_next)
11911191
{
1192+
if (timer->tr_paused)
1193+
continue;
11921194
# ifdef WIN3264
11931195
this_due = (long)(((double)(timer->tr_due.QuadPart - now.QuadPart)
11941196
/ (double)fr.QuadPart) * 1000);
@@ -1251,6 +1253,13 @@ stop_timer(timer_T *timer)
12511253
free_timer(timer);
12521254
}
12531255

1256+
void
1257+
stop_all_timers(void)
1258+
{
1259+
while (first_timer != NULL)
1260+
stop_timer(first_timer);
1261+
}
1262+
12541263
void
12551264
add_timer_info(typval_T *rettv, timer_T *timer)
12561265
{
@@ -1283,6 +1292,7 @@ add_timer_info(typval_T *rettv, timer_T *timer)
12831292

12841293
dict_add_nr_str(dict, "repeat",
12851294
(long)(timer->tr_repeat < 0 ? -1 : timer->tr_repeat + 1), NULL);
1295+
dict_add_nr_str(dict, "paused", (long)(timer->tr_paused), NULL);
12861296

12871297
di = dictitem_alloc((char_u *)"callback");
12881298
if (di != NULL)

src/if_mzsch.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,8 +1009,11 @@ static intptr_t _tls_index = 0;
10091009
#endif
10101010

10111011
int
1012-
mzscheme_main(int argc, char** argv)
1012+
mzscheme_main()
10131013
{
1014+
int argc = 0;
1015+
char *argv = NULL;
1016+
10141017
#ifdef DYNAMIC_MZSCHEME
10151018
/*
10161019
* Racket requires trampolined startup. We can not load it later.
@@ -1019,16 +1022,16 @@ mzscheme_main(int argc, char** argv)
10191022
if (!mzscheme_enabled(FALSE))
10201023
{
10211024
disabled = TRUE;
1022-
return vim_main2(argc, argv);
1025+
return vim_main2();
10231026
}
10241027
#endif
10251028
#ifdef HAVE_TLS_SPACE
10261029
scheme_register_tls_space(&tls_space, _tls_index);
10271030
#endif
10281031
#ifdef TRAMPOLINED_MZVIM_STARTUP
1029-
return scheme_main_setup(TRUE, mzscheme_env_main, argc, argv);
1032+
return scheme_main_setup(TRUE, mzscheme_env_main, argc, &argv);
10301033
#else
1031-
return mzscheme_env_main(NULL, argc, argv);
1034+
return mzscheme_env_main(NULL, argc, &argv);
10321035
#endif
10331036
}
10341037

@@ -1056,7 +1059,7 @@ mzscheme_env_main(Scheme_Env *env, int argc, char **argv)
10561059
* We trampoline into vim_main2
10571060
* Passing argc, argv through from mzscheme_main
10581061
*/
1059-
vim_main_result = vim_main2(argc, argv);
1062+
vim_main_result = vim_main2();
10601063
#if !defined(TRAMPOLINED_MZVIM_STARTUP) && defined(MZ_PRECISE_GC)
10611064
/* releasing dummy */
10621065
MZ_GC_REG();

0 commit comments

Comments
 (0)