aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/insexpand.c27
-rw-r--r--src/nvim/ops.c7
-rw-r--r--src/nvim/optionstr.c24
-rw-r--r--src/nvim/quickfix.c7
-rw-r--r--src/nvim/tag.c8
5 files changed, 31 insertions, 42 deletions
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index 7f81731b26..6de3b0a9d0 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -2258,14 +2258,14 @@ static void copy_global_to_buflocal_cb(Callback *globcb, Callback *bufcb)
/// Invoked when the 'completefunc' option is set. The option value can be a
/// name of a function (string), or function(<name>) or funcref(<name>) or a
/// lambda expression.
-int set_completefunc_option(void)
+void set_completefunc_option(char **errmsg)
{
- int retval = option_set_callback_func(curbuf->b_p_cfu, &cfu_cb);
- if (retval == OK) {
- set_buflocal_cfu_callback(curbuf);
+ if (option_set_callback_func(curbuf->b_p_cfu, &cfu_cb) == FAIL) {
+ *errmsg = e_invarg;
+ return;
}
- return retval;
+ set_buflocal_cfu_callback(curbuf);
}
/// Copy the global 'completefunc' callback function to the buffer-local
@@ -2279,14 +2279,13 @@ void set_buflocal_cfu_callback(buf_T *buf)
/// Invoked when the 'omnifunc' option is set. The option value can be a
/// name of a function (string), or function(<name>) or funcref(<name>) or a
/// lambda expression.
-int set_omnifunc_option(void)
+void set_omnifunc_option(buf_T *buf, char **errmsg)
{
- int retval = option_set_callback_func(curbuf->b_p_ofu, &ofu_cb);
- if (retval == OK) {
- set_buflocal_ofu_callback(curbuf);
+ if (option_set_callback_func(buf->b_p_ofu, &ofu_cb) == FAIL) {
+ *errmsg = e_invarg;
+ return;
}
-
- return retval;
+ set_buflocal_ofu_callback(buf);
}
/// Copy the global 'omnifunc' callback function to the buffer-local 'omnifunc'
@@ -2300,7 +2299,7 @@ void set_buflocal_ofu_callback(buf_T *buf)
/// Invoked when the 'thesaurusfunc' option is set. The option value can be a
/// name of a function (string), or function(<name>) or funcref(<name>) or a
/// lambda expression.
-int set_thesaurusfunc_option(void)
+void set_thesaurusfunc_option(char **errmsg)
{
int retval;
@@ -2312,7 +2311,9 @@ int set_thesaurusfunc_option(void)
retval = option_set_callback_func(p_tsrfu, &tsrfu_cb);
}
- return retval;
+ if (retval == FAIL) {
+ *errmsg = e_invarg;
+ }
}
/// Mark the global 'completefunc' 'omnifunc' and 'thesaurusfunc' callbacks with
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index ac4116095f..435ca106ab 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -5626,10 +5626,11 @@ static void op_colon(oparg_T *oap)
static Callback opfunc_cb;
/// Process the 'operatorfunc' option value.
-/// @return OK or FAIL
-int set_operatorfunc_option(void)
+void set_operatorfunc_option(char **errmsg)
{
- return option_set_callback_func(p_opfunc, &opfunc_cb);
+ if (option_set_callback_func(p_opfunc, &opfunc_cb) == FAIL) {
+ *errmsg = e_invarg;
+ }
}
#if defined(EXITFREE)
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index 1da3f3f94a..ea05c8e56b 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -1728,29 +1728,17 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
|| varp == &p_pex) { // '*expr' options
did_set_optexpr(curbuf, curwin, varp, gvarp);
} else if (gvarp == &p_cfu) { // 'completefunc'
- if (set_completefunc_option() == FAIL) {
- errmsg = e_invarg;
- }
+ set_completefunc_option(&errmsg);
} else if (gvarp == &p_ofu) { // 'omnifunc'
- if (set_omnifunc_option() == FAIL) {
- errmsg = e_invarg;
- }
+ set_omnifunc_option(curbuf, &errmsg);
} else if (gvarp == &p_tsrfu) { // 'thesaurusfunc'
- if (set_thesaurusfunc_option() == FAIL) {
- errmsg = e_invarg;
- }
+ set_thesaurusfunc_option(&errmsg);
} else if (varp == &p_opfunc) { // 'operatorfunc'
- if (set_operatorfunc_option() == FAIL) {
- errmsg = e_invarg;
- }
+ set_operatorfunc_option(&errmsg);
} else if (varp == &p_qftf) { // 'quickfixtextfunc'
- if (qf_process_qftf_option() == FAIL) {
- errmsg = e_invarg;
- }
+ qf_process_qftf_option(&errmsg);
} else if (gvarp == &p_tfu) { // 'tagfunc'
- if (set_tagfunc_option() == FAIL) {
- errmsg = e_invarg;
- }
+ set_tagfunc_option(&errmsg);
} else {
did_set_option_listflags(curbuf, curwin, varp, errbuf, errbuflen, &errmsg);
}
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 44daefddc7..5518fdfa51 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -3854,10 +3854,11 @@ static buf_T *qf_find_buf(qf_info_T *qi)
}
/// Process the 'quickfixtextfunc' option value.
-/// @return OK or FAIL
-int qf_process_qftf_option(void)
+void qf_process_qftf_option(char **errmsg)
{
- return option_set_callback_func(p_qftf, &qftf_cb);
+ if (option_set_callback_func(p_qftf, &qftf_cb) == FAIL) {
+ *errmsg = e_invarg;
+ }
}
/// Update the w:quickfix_title variable in the quickfix/location list window in
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 18c7684584..197184c181 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -210,22 +210,20 @@ static Callback tfu_cb; // 'tagfunc' callback function
/// Reads the 'tagfunc' option value and convert that to a callback value.
/// Invoked when the 'tagfunc' option is set. The option value can be a name of
/// a function (string), or function(<name>) or funcref(<name>) or a lambda.
-int set_tagfunc_option(void)
+void set_tagfunc_option(char **errmsg)
{
callback_free(&tfu_cb);
callback_free(&curbuf->b_tfu_cb);
if (*curbuf->b_p_tfu == NUL) {
- return OK;
+ return;
}
if (option_set_callback_func(curbuf->b_p_tfu, &tfu_cb) == FAIL) {
- return FAIL;
+ *errmsg = e_invarg;
}
callback_copy(&curbuf->b_tfu_cb, &tfu_cb);
-
- return OK;
}
#if defined(EXITFREE)