diff options
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r-- | src/evalfunc.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index d644a3ee54..8970ac7937 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -45,6 +45,7 @@ static void f_did_filetype(typval_T *argvars, typval_T *rettv); static void f_echoraw(typval_T *argvars, typval_T *rettv); static void f_empty(typval_T *argvars, typval_T *rettv); static void f_environ(typval_T *argvars, typval_T *rettv); +static void f_err_teapot(typval_T *argvars, typval_T *rettv); static void f_escape(typval_T *argvars, typval_T *rettv); static void f_eval(typval_T *argvars, typval_T *rettv); static void f_eventhandler(typval_T *argvars, typval_T *rettv); @@ -1881,6 +1882,8 @@ static funcentry_T global_functions[] = ret_number_bool, f_empty}, {"environ", 0, 0, 0, NULL, ret_dict_string, f_environ}, + {"err_teapot", 0, 1, 0, NULL, + ret_number_bool, f_err_teapot}, {"escape", 2, 2, FEARG_1, arg2_string, ret_string, f_escape}, {"eval", 1, 1, FEARG_1, arg1_string, @@ -3923,6 +3926,33 @@ f_environ(typval_T *argvars UNUSED, typval_T *rettv) } /* + * "err_teapot()" function + */ + static void +f_err_teapot(typval_T *argvars, typval_T *rettv UNUSED) +{ + if (argvars[0].v_type != VAR_UNKNOWN) + { + if (argvars[0].v_type == VAR_STRING) + { + char_u *s = tv_get_string_strict(&argvars[0]); + if (s == NULL || *skipwhite(s) == NUL) + return; + } + + int err = FALSE; + int do_503 = eval_expr_to_bool(&argvars[0], &err); + if (!err && do_503) + { + emsg(_(e_coffee_currently_not_available)); + return; + } + } + + emsg(_(e_im_a_teapot)); +} + +/* * "escape({string}, {chars})" function */ static void @@ -6458,6 +6488,14 @@ f_has(typval_T *argvars, typval_T *rettv) 0 #endif }, + {":tearoff", +// same #ifdef as used for ex_tearoff(). +#if defined(FEAT_GUI_MSWIN) && defined(FEAT_MENU) && defined(FEAT_TEAROFF) + 1 +#else + 0 +#endif + }, {NULL, 0} }; |