aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/eval')
-rw-r--r--src/nvim/eval/funcs.c8
-rw-r--r--src/nvim/eval/typval.c11
-rw-r--r--src/nvim/eval/userfunc.c8
-rw-r--r--src/nvim/eval/vars.c11
4 files changed, 23 insertions, 15 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 691ccfe535..f24285063e 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -1839,7 +1839,7 @@ static void f_eval(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = 0;
} else if (*s != NUL) {
- emsg(_(e_trailing));
+ semsg(_(e_trailing_arg), s);
}
}
@@ -4705,7 +4705,7 @@ static void f_islocked(typval_T *argvars, typval_T *rettv, FunPtr fptr)
FNE_CHECK_START);
if (end != NULL && lv.ll_name != NULL) {
if (*end != NUL) {
- emsg(_(e_trailing));
+ semsg(_(e_trailing_arg), end);
} else {
if (lv.ll_tv == NULL) {
di = find_var(lv.ll_name, lv.ll_name_len, NULL, true);
@@ -9917,7 +9917,11 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// at this point the buffer has no terminal instance associated yet, so unset
// the 'swapfile' option to ensure no swap file will be created
curbuf->b_p_swf = false;
+
+ apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, false, curbuf);
(void)setfname(curbuf, (char *)NameBuff, NULL, true);
+ apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, false, curbuf);
+
// Save the job id and pid in b:terminal_job_{id,pid}
Error err = ERROR_INIT;
// deprecated: use 'channel' buffer option
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index fd57b45e86..ff1808ed91 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -1657,13 +1657,14 @@ void callback_copy(Callback *dest, Callback *src)
/// Generate a string description of a callback
char *callback_to_string(Callback *cb)
{
- size_t msglen = 100;
+ if (cb->type == kCallbackLua) {
+ return nlua_funcref_str(cb->data.luaref);
+ }
+
+ const size_t msglen = 100;
char *msg = (char *)xmallocz(msglen);
switch (cb->type) {
- case kCallbackLua:
- snprintf(msg, msglen, "<lua: %d>", cb->data.luaref);
- break;
case kCallbackFuncref:
// TODO(tjdevries): Is this enough space for this?
snprintf(msg, msglen, "<vim function: %s>", cb->data.funcref);
@@ -1672,7 +1673,7 @@ char *callback_to_string(Callback *cb)
snprintf(msg, msglen, "<vim partial: %s>", cb->data.partial->pt_name);
break;
default:
- snprintf(msg, msglen, "%s", "");
+ *msg = '\0';
break;
}
return msg;
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index a90148bf23..2f4799db57 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -2039,7 +2039,7 @@ void ex_function(exarg_T *eap)
//
if (!paren) {
if (!ends_excmd(*skipwhite((char *)p))) {
- emsg(_(e_trailing));
+ semsg(_(e_trailing_arg), p);
goto ret_free;
}
eap->nextcmd = (char *)check_nextcmd(p);
@@ -2163,7 +2163,7 @@ void ex_function(exarg_T *eap)
if (*p == '\n') {
line_arg = p + 1;
} else if (*p != NUL && *p != '"' && !eap->skip && !did_emsg) {
- emsg(_(e_trailing));
+ semsg(_(e_trailing_arg), p);
}
/*
@@ -2703,7 +2703,7 @@ void ex_delfunction(exarg_T *eap)
}
if (!ends_excmd(*skipwhite((char *)p))) {
xfree(name);
- emsg(_(e_trailing));
+ semsg(_(e_trailing_arg), p);
return;
}
eap->nextcmd = (char *)check_nextcmd(p);
@@ -3021,7 +3021,7 @@ void ex_call(exarg_T *eap)
if (!ends_excmd(*arg)) {
if (!failed && !aborting()) {
emsg_severe = true;
- emsg(_(e_trailing));
+ semsg(_(e_trailing_arg), arg);
}
} else {
eap->nextcmd = (char *)check_nextcmd(arg);
diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c
index d01fff6b94..ea1c3a8c4e 100644
--- a/src/nvim/eval/vars.c
+++ b/src/nvim/eval/vars.c
@@ -80,7 +80,7 @@ static list_T *heredoc_get(exarg_T *eap, char *cmd)
marker = skipwhite(cmd);
p = (char *)skiptowhite((char_u *)marker);
if (*skipwhite(p) != NUL && *skipwhite(p) != '"') {
- emsg(_(e_trailing));
+ semsg(_(e_trailing_arg), p);
return NULL;
}
*p = NUL;
@@ -460,7 +460,7 @@ static const char *list_arg_vars(exarg_T *eap, const char *arg, int *first)
arg = find_name_end(arg, NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
if (!ascii_iswhite(*arg) && !ends_excmd(*arg)) {
emsg_severe = true;
- emsg(_(e_trailing));
+ semsg(_(e_trailing_arg), arg);
break;
}
} else {
@@ -678,8 +678,11 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
if (!failed) {
if (opt_type != gov_string || s != NULL) {
- set_option_value(arg, n, s, opt_flags);
+ char *err = set_option_value(arg, n, s, opt_flags);
arg_end = p;
+ if (err != NULL) {
+ emsg(_(err));
+ }
} else {
emsg(_(e_stringreq));
}
@@ -812,7 +815,7 @@ static void ex_unletlock(exarg_T *eap, char *argstart, int deep, ex_unletlock_ca
|| (!ascii_iswhite(*name_end) && !ends_excmd(*name_end))) {
if (name_end != NULL) {
emsg_severe = true;
- emsg(_(e_trailing));
+ semsg(_(e_trailing_arg), name_end);
}
if (!(eap->skip || error)) {
clear_lval(&lv);