Problem: Error from setting an option is silently ignored.
Solution: Handle option value errors better. Fix uses of N_().
buf_copy_options(buf, BCO_ENTER);
curbuf = buf;
#ifdef FEAT_QUICKFIX
- set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
- set_option_value((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL);
+ set_option_value_give_err((char_u *)"bt",
+ 0L, (char_u *)"nofile", OPT_LOCAL);
+ set_option_value_give_err((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL);
#endif
if (curbuf->b_ml.ml_mfp == NULL)
ml_open(curbuf);
// encryption uses padding and MAC, that does not work very well with
// swap and undo files, so disable them
mf_close_file(curbuf, TRUE); // remove the swap file
- set_option_value((char_u *)"swf", 0, NULL, OPT_LOCAL);
+ set_option_value_give_err((char_u *)"swf", 0, NULL, OPT_LOCAL);
msg_scroll = TRUE;
msg(_("Note: Encryption of swapfile not supported, disabling swap file"));
}
if (store)
{
- set_option_value((char_u *)"key", 0L, p1, OPT_LOCAL);
+ set_option_value_give_err((char_u *)"key", 0L, p1, OPT_LOCAL);
crypt_free_key(p1);
p1 = curbuf->b_p_key;
#ifdef FEAT_SODIUM
curwin = wp;
curbuf = curwin->w_buffer;
++curbuf_lock;
- set_option_value((char_u *)"diff", (long)value, NULL, OPT_LOCAL);
+ set_option_value_give_err((char_u *)"diff", (long)value, NULL, OPT_LOCAL);
--curbuf_lock;
curwin = old_curwin;
curbuf = curwin->w_buffer;
if (!p_paste)
// Also have the side effects of setting 'paste' to make it work much
// faster.
- set_option_value((char_u *)"paste", TRUE, NULL, 0);
+ set_option_value_give_err((char_u *)"paste", TRUE, NULL, 0);
for (;;)
{
--no_mapping;
allow_keys = save_allow_keys;
if (!save_paste)
- set_option_value((char_u *)"paste", FALSE, NULL, 0);
+ set_option_value_give_err((char_u *)"paste", FALSE, NULL, 0);
return ret_char;
}
// If it's still empty it was changed and restored, need to restore in
// the complicated way.
if (*p_cpo == NUL)
- set_option_value((char_u *)"cpo", 0L, save_cpo, 0);
+ set_option_value_give_err((char_u *)"cpo", 0L, save_cpo, 0);
free_string_option(save_cpo);
}
// If it's still empty it was changed and restored, need to restore in
// the complicated way.
if (*p_cpo == NUL)
- set_option_value((char_u *)"cpo", 0L, save_cpo, 0);
+ set_option_value_give_err((char_u *)"cpo", 0L, save_cpo, 0);
free_string_option(save_cpo);
}
strval = tv_get_string_buf_chk(varp, nbuf);
}
if (!error && strval != NULL)
- set_option_value(varname, numval, strval, OPT_LOCAL);
+ set_option_value_give_err(varname, numval, strval, OPT_LOCAL);
}
/*
// Clear 'shm' to avoid that the file message overwrites
// any output from the command.
p_shm_save = vim_strsave(p_shm);
- set_option_value((char_u *)"shm", 0L, (char_u *)"", 0);
+ set_option_value_give_err((char_u *)"shm",
+ 0L, (char_u *)"", 0);
do_argfile(eap, i);
- set_option_value((char_u *)"shm", 0L, p_shm_save, 0);
+ set_option_value_give_err((char_u *)"shm",
+ 0L, p_shm_save, 0);
vim_free(p_shm_save);
}
if (curwin->w_arg_idx != i)
// Go to the next buffer. Clear 'shm' to avoid that the file
// message overwrites any output from the command.
p_shm_save = vim_strsave(p_shm);
- set_option_value((char_u *)"shm", 0L, (char_u *)"", 0);
+ set_option_value_give_err((char_u *)"shm", 0L, (char_u *)"", 0);
goto_buffer(eap, DOBUF_FIRST, FORWARD, next_fnum);
- set_option_value((char_u *)"shm", 0L, p_shm_save, 0);
+ set_option_value_give_err((char_u *)"shm", 0L, p_shm_save, 0);
vim_free(p_shm_save);
// If autocommands took us elsewhere, quit here.
// Clear 'shm' to avoid that the file message overwrites
// any output from the command.
p_shm_save = vim_strsave(p_shm);
- set_option_value((char_u *)"shm", 0L, (char_u *)"", 0);
+ set_option_value_give_err((char_u *)"shm", 0L, (char_u *)"", 0);
ex_cnext(eap);
- set_option_value((char_u *)"shm", 0L, p_shm_save, 0);
+ set_option_value_give_err((char_u *)"shm", 0L, p_shm_save, 0);
vim_free(p_shm_save);
// If jumping to the next quickfix entry fails, quit here
{
if (STRCMP(eap->arg, "mswin") == 0)
{
- set_option_value((char_u *)"selection", 0L, (char_u *)"exclusive", 0);
- set_option_value((char_u *)"selectmode", 0L, (char_u *)"mouse,key", 0);
- set_option_value((char_u *)"mousemodel", 0L, (char_u *)"popup", 0);
- set_option_value((char_u *)"keymodel", 0L,
- (char_u *)"startsel,stopsel", 0);
+ set_option_value_give_err((char_u *)"selection",
+ 0L, (char_u *)"exclusive", 0);
+ set_option_value_give_err((char_u *)"selectmode",
+ 0L, (char_u *)"mouse,key", 0);
+ set_option_value_give_err((char_u *)"mousemodel",
+ 0L, (char_u *)"popup", 0);
+ set_option_value_give_err((char_u *)"keymodel",
+ 0L, (char_u *)"startsel,stopsel", 0);
}
else if (STRCMP(eap->arg, "xterm") == 0)
{
- set_option_value((char_u *)"selection", 0L, (char_u *)"inclusive", 0);
- set_option_value((char_u *)"selectmode", 0L, (char_u *)"", 0);
- set_option_value((char_u *)"mousemodel", 0L, (char_u *)"extend", 0);
- set_option_value((char_u *)"keymodel", 0L, (char_u *)"", 0);
+ set_option_value_give_err((char_u *)"selection",
+ 0L, (char_u *)"inclusive", 0);
+ set_option_value_give_err((char_u *)"selectmode", 0L, (char_u *)"", 0);
+ set_option_value_give_err((char_u *)"mousemodel",
+ 0L, (char_u *)"extend", 0);
+ set_option_value_give_err((char_u *)"keymodel", 0L, (char_u *)"", 0);
}
else
semsg(_(e_invalid_argument_str), eap->arg);
if (STRNCMP(arg, "FALLBACK ", 9) == 0)
arg += 9;
- set_option_value((char_u *)"filetype", 0L, arg, OPT_LOCAL);
+ set_option_value_give_err((char_u *)"filetype", 0L, arg, OPT_LOCAL);
if (arg != eap->arg)
did_filetype = FALSE;
}
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf);
(void)setfname(curbuf, (char_u *)_("[Command Line]"), NULL, TRUE);
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
- set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
+ set_option_value_give_err((char_u *)"bt",
+ 0L, (char_u *)"nofile", OPT_LOCAL);
curbuf->b_p_ma = TRUE;
#ifdef FEAT_FOLDING
curwin->w_p_fen = FALSE;
add_map((char_u *)"<buffer> <Tab> <C-X><C-V>", INSERT);
add_map((char_u *)"<buffer> <Tab> a<C-X><C-V>", NORMAL);
}
- set_option_value((char_u *)"ft", 0L, (char_u *)"vim", OPT_LOCAL);
+ set_option_value_give_err((char_u *)"ft",
+ 0L, (char_u *)"vim", OPT_LOCAL);
}
--curbuf_lock;
mlen - typebuf.tb_maplen);
del_typebuf(mlen, 0); // remove the chars
- set_option_value((char_u *)"paste", (long)!p_paste, NULL, 0);
+ set_option_value_give_err((char_u *)"paste",
+ (long)!p_paste, NULL, 0);
if (!(State & INSERT))
{
msg_col = 0;
* Reset 'paste'. It's useful in the terminal, but not in the GUI. It
* breaks the Paste toolbar button.
*/
- set_option_value((char_u *)"paste", 0L, NULL, 0);
+ set_option_value_give_err((char_u *)"paste", 0L, NULL, 0);
// Set t_Co to the number of colors: RGB.
set_color_count(256 * 256 * 256);
* Set up the fonts. First use a font specified with "-fn" or "-font".
*/
if (font_argument != NULL)
- set_option_value((char_u *)"gfn", 0L, (char_u *)font_argument, 0);
+ set_option_value_give_err((char_u *)"gfn",
+ 0L, (char_u *)font_argument, 0);
if (
#ifdef FEAT_XFONTSET
(*p_guifontset == NUL
// background color, unless the user has set it already.
if (!option_was_set((char_u *)"bg") && STRCMP(p_bg, gui_bg_default()) != 0)
{
- set_option_value((char_u *)"bg", 0L, gui_bg_default(), 0);
+ set_option_value_give_err((char_u *)"bg", 0L, gui_bg_default(), 0);
highlight_changed();
}
}
* did_set_string_option() in option.c prohibits changing 'termencoding'
* to something else than UTF-8 if the GUI is in use.
*/
- set_option_value((char_u *)"termencoding", 0L, (char_u *)"utf-8", 0);
+ set_option_value_give_err((char_u *)"termencoding",
+ 0L, (char_u *)"utf-8", 0);
#ifdef FEAT_TOOLBAR
gui_gtk_register_stock_icons();
if (STRCMP(curbuf->b_p_ft, "help") != 0)
{
++curbuf_lock;
- set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL);
+ set_option_value_give_err((char_u *)"ft",
+ 0L, (char_u *)"help", OPT_LOCAL);
--curbuf_lock;
}
&& dark != (*p_bg == 'd')
&& !option_was_set((char_u *)"bg"))
{
- set_option_value((char_u *)"bg", 0L,
- (char_u *)(dark ? "dark" : "light"), 0);
+ set_option_value_give_err((char_u *)"bg",
+ 0L, (char_u *)(dark ? "dark" : "light"), 0);
reset_option_was_set((char_u *)"bg");
}
}
sval = (char_u *)Tcl_GetStringFromObj(objv[objn], NULL);
if (err == TCL_OK)
{
- set_option_value(option, lval, sval, OPT_LOCAL);
+ set_option_value_give_err(option, lval, sval, OPT_LOCAL);
err = vimerror(interp);
}
}
use_gvimrc = (char_u *)"NONE";
#endif
parmp->clean = TRUE;
- set_option_value((char_u *)"vif", 0L, (char_u *)"NONE", 0);
+ set_option_value_give_err((char_u *)"vif",
+ 0L, (char_u *)"NONE", 0);
}
else if (STRNICMP(argv[0] + argv_idx, "literal", 7) == 0)
{
case 'A': // "-A" start in Arabic mode
#ifdef FEAT_ARABIC
- set_option_value((char_u *)"arabic", 1L, NULL, 0);
+ set_option_value_give_err((char_u *)"arabic", 1L, NULL, 0);
#else
mch_errmsg(_(e_arabic_cannot_be_used_not_enabled_at_compile_time));
mch_exit(2);
case 'H': // "-H" start in Hebrew mode: rl + hkmap set
#ifdef FEAT_RIGHTLEFT
p_hkmap = TRUE;
- set_option_value((char_u *)"rl", 1L, NULL, 0);
+ set_option_value_give_err((char_u *)"rl", 1L, NULL, 0);
#else
mch_errmsg(_(e_hebrew_cannot_be_used_not_enabled_at_compile_time));
mch_exit(2);
case 'l': // "-l" lisp mode, 'lisp' and 'showmatch' on
#ifdef FEAT_LISP
- set_option_value((char_u *)"lisp", 1L, NULL, 0);
+ set_option_value_give_err((char_u *)"lisp", 1L, NULL, 0);
p_sm = TRUE;
#endif
break;
p_verbose = get_number_arg((char_u *)argv[0], &argv_idx, 10);
if (argv[0][argv_idx] != NUL)
{
- set_option_value((char_u *)"verbosefile", 0L,
- (char_u *)argv[0] + argv_idx, 0);
+ set_option_value_give_err((char_u *)"verbosefile",
+ 0L, (char_u *)argv[0] + argv_idx, 0);
argv_idx = (int)STRLEN(argv[0]);
}
break;
if (vim_isdigit(((char_u *)argv[0])[argv_idx]))
{
n = get_number_arg((char_u *)argv[0], &argv_idx, 10);
- set_option_value((char_u *)"window", n, NULL, 0);
+ set_option_value_give_err((char_u *)"window", n, NULL, 0);
break;
}
want_argument = TRUE;
#endif
case 'i': // "-i {viminfo}" use for viminfo
- set_option_value((char_u *)"vif", 0L, (char_u *)argv[0], 0);
+ set_option_value_give_err((char_u *)"vif",
+ 0L, (char_u *)argv[0], 0);
break;
case 's': // "-s {scriptin}" read from script file
{
argv_idx = 0;
n = get_number_arg((char_u *)argv[0], &argv_idx, 10);
- set_option_value((char_u *)"window", n, NULL, 0);
+ set_option_value_give_err((char_u *)"window",
+ n, NULL, 0);
argv_idx = -1;
break;
}
p_shm_save = vim_strsave(p_shm);
vim_snprintf(buf, 100, "F%s", p_shm);
- set_option_value((char_u *)"shm", 0L, (char_u *)buf, 0);
+ set_option_value_give_err((char_u *)"shm",
+ 0L, (char_u *)buf, 0);
}
}
else
if (p_shm_save != NULL)
{
- set_option_value((char_u *)"shm", 0L, p_shm_save, 0);
+ set_option_value_give_err((char_u *)"shm", 0L, p_shm_save, 0);
vim_free(p_shm_save);
}
set_fileformat(b0_ff - 1, OPT_LOCAL);
if (b0_fenc != NULL)
{
- set_option_value((char_u *)"fenc", 0L, b0_fenc, OPT_LOCAL);
+ set_option_value_give_err((char_u *)"fenc", 0L, b0_fenc, OPT_LOCAL);
vim_free(b0_fenc);
}
unchanged(curbuf, TRUE, TRUE);
if (*buf->b_p_key != NUL && STRCMP(curbuf->b_p_key, buf->b_p_key) != 0)
{
msg_puts(_("Using crypt key from swap file for the text file.\n"));
- set_option_value((char_u *)"key", 0L, buf->b_p_key, OPT_LOCAL);
+ set_option_value_give_err((char_u *)"key", 0L, buf->b_p_key, OPT_LOCAL);
}
#endif
redraw_curbuf_later(NOT_VALID);
params.argv = argv;
common_init(¶ms);
- set_option_value((char_u *)"encoding", 0, (char_u *)"utf-8", 0);
+ set_option_value_give_err((char_u *)"encoding", 0, (char_u *)"utf-8", 0);
init_chartab();
test_trunc_string();
test_trunc_string_mbyte();
test_vim_snprintf();
- set_option_value((char_u *)"encoding", 0, (char_u *)"latin1", 0);
+ set_option_value_give_err((char_u *)"encoding", 0, (char_u *)"latin1", 0);
init_chartab();
test_trunc_string();
test_vim_snprintf();
#ifdef FEAT_GUI
if (found_reverse_arg)
- set_option_value((char_u *)"bg", 0L, (char_u *)"dark", 0);
+ set_option_value_give_err((char_u *)"bg", 0L, (char_u *)"dark", 0);
#endif
curbuf->b_p_initialized = TRUE;
// NOTE: mlterm's author is being asked to 'set' a variable
// instead of an environment variable due to inheritance.
if (mch_getenv((char_u *)"MLTERM") != NULL)
- set_option_value((char_u *)"tbidi", 1L, NULL, 0);
+ set_option_value_give_err((char_u *)"tbidi", 1L, NULL, 0);
#endif
didset_options2();
&& vim_strchr((char_u *)"!&<", *arg) != NULL)
errmsg = e_no_white_space_allowed_between_option_and;
else
- errmsg = N_(e_unknown_option);
+ errmsg = e_unknown_option;
goto skip;
}
if (vim_strchr((char_u *)"=:!&<", nextchar) == NULL
&& (!(options[opt_idx].flags & P_BOOL)
|| nextchar == '?'))
- errmsg = N_(e_option_not_supported);
+ errmsg = e_option_not_supported;
goto skip;
}
{
if (flags & (P_SECURE | P_NO_ML))
{
- errmsg = N_(e_not_allowed_in_modeline);
+ errmsg = e_not_allowed_in_modeline;
goto skip;
}
if ((flags & P_MLE) && !p_mle)
{
- errmsg = N_(e_not_allowed_in_modeline_when_modelineexpr_is_off);
+ errmsg = e_not_allowed_in_modeline_when_modelineexpr_is_off;
goto skip;
}
#ifdef FEAT_DIFF
p = find_termcode(key_name);
if (p == NULL)
{
- errmsg = N_(e_key_code_not_set);
+ errmsg = e_key_code_not_set;
goto skip;
}
else
if (i == 0 || (arg[i] != NUL
&& !VIM_ISWHITE(arg[i])))
{
- errmsg = N_(e_number_required_after_equal);
+ errmsg = e_number_required_after_equal;
goto skip;
}
}
else
{
- errmsg = N_(e_number_required_after_equal);
+ errmsg = e_number_required_after_equal;
goto skip;
}
if (nextchar == '&')
{
if (add_termcap_entry(key_name, TRUE) == FAIL)
- errmsg = N_(e_not_found_in_termcap);
+ errmsg = e_not_found_in_termcap;
}
else
{
#if defined(FEAT_EVAL)
int old_global_value = 0;
#endif
+ char *errmsg = NULL;
// Disallow changing some options from secure mode
if ((secure
&& curbuf->b_term != NULL && !term_is_finished(curbuf))))
{
curbuf->b_p_ma = FALSE;
- return N_(e_cannot_make_terminal_with_running_job_modifiable);
+ return e_cannot_make_terminal_with_running_job_modifiable;
}
# endif
redraw_titles();
if (win->w_p_pvw && win != curwin)
{
curwin->w_p_pvw = FALSE;
- return N_(e_preview_window_already_exists);
+ return e_preview_window_already_exists;
}
}
}
else if ((int *)varp == &curwin->w_p_spell)
{
if (curwin->w_p_spell)
- {
- char *errmsg = did_set_spelllang(curwin);
-
- if (errmsg != NULL)
- emsg(_(errmsg));
- }
+ errmsg = did_set_spelllang(curwin);
}
#endif
# ifdef FEAT_KEYMAP
// Force-set the necessary keymap for arabic
- set_option_value((char_u *)"keymap", 0L, (char_u *)"arabic",
- OPT_LOCAL);
+ errmsg = set_option_value((char_u *)"keymap",
+ 0L, (char_u *)"arabic", OPT_LOCAL);
# endif
}
else
!has_vtp_working())
{
p_tgc = 0;
- return N_(e_24_bit_colors_are_not_supported_on_this_environment);
+ return e_24_bit_colors_are_not_supported_on_this_environment;
}
if (is_term_win32())
swap_tcap();
if ((opt_flags & OPT_NO_REDRAW) == 0)
check_redraw(options[opt_idx].flags);
- return NULL;
+ return errmsg;
}
/*
* Set the value of option "name".
* Use "string" for string options, use "number" for other options.
*
- * Returns NULL on success or error message on error.
+ * Returns NULL on success or an untranslated error message on error.
*/
char *
set_option_value(
return NULL;
}
+/*
+ * Call set_option_value() and when an error is returned report it.
+ */
+ void
+set_option_value_give_err(
+ char_u *name,
+ long number,
+ char_u *string,
+ int opt_flags) // OPT_LOCAL or 0 (both)
+{
+ char *errmsg = set_option_value(name, number, string, opt_flags);
+
+ if (errmsg != NULL)
+ emsg(_(errmsg));
+}
+
/*
* Get the terminal code for a terminal option.
* Returns NULL when not found.
/*
* Set a string option to a new value, and handle the effects.
*
- * Returns NULL on success or error message on error.
+ * Returns NULL on success or an untranslated error message on error.
*/
char *
set_string_option(
char_u *saved_oldval_g = NULL;
char_u *saved_newval = NULL;
#endif
- char *r = NULL;
+ char *errmsg = NULL;
int value_checked = FALSE;
if (is_hidden_option(opt_idx)) // don't set hidden option
saved_newval = vim_strsave(s);
}
#endif
- if ((r = did_set_string_option(opt_idx, varp, TRUE, oldval, NULL,
+ if ((errmsg = did_set_string_option(opt_idx, varp, TRUE, oldval, NULL,
opt_flags, &value_checked)) == NULL)
did_set_option(opt_idx, opt_flags, TRUE, value_checked);
#if defined(FEAT_EVAL)
// call autocommand after handling side effects
- if (r == NULL)
+ if (errmsg == NULL)
trigger_optionsset_string(opt_idx, opt_flags,
saved_oldval, saved_oldval_l,
saved_oldval_g, saved_newval);
vim_free(saved_newval);
#endif
}
- return r;
+ return errmsg;
}
/*
{
if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex,
*p_pm == '.' ? p_pm + 1 : p_pm) == 0)
- errmsg = N_(e_backupext_and_patchmode_are_equal);
+ errmsg = e_backupext_and_patchmode_are_equal;
}
#ifdef FEAT_LINEBREAK
// 'breakindentopt'
if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK)
errmsg = e_invalid_argument;
else if (set_chars_option(curwin, &p_fcs) != NULL)
- errmsg = _(e_conflicts_with_value_of_fillchars);
+ errmsg = e_conflicts_with_value_of_fillchars;
else
{
tabpage_T *tp;
{
if (set_chars_option(wp, &wp->w_p_lcs) != NULL)
{
- errmsg = _(e_conflicts_with_value_of_listchars);
+ errmsg = e_conflicts_with_value_of_listchars;
goto ambw_end;
}
}
for (s = *varp; *s; )
{
if (ptr2cells(s) != 1)
- errmsg = N_(e_showbreak_contains_unprintable_or_wide_character);
+ errmsg = e_showbreak_contains_unprintable_or_wide_character;
MB_PTR_ADV(s);
}
}
}
else
# endif
- errmsg = N_(e_invalid_fonts);
+ errmsg = e_invalid_fonts;
}
}
redraw_gui_only = TRUE;
else if (varp == &p_guifontset)
{
if (STRCMP(p_guifontset, "*") == 0)
- errmsg = N_(e_cant_select_fontset);
+ errmsg = e_cant_select_fontset;
else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
- errmsg = N_(e_invalid_fontset);
+ errmsg = e_invalid_fontset;
redraw_gui_only = TRUE;
}
# endif
{
// Edit a new, empty buffer. Set options for a "wipeout"
// buffer.
- set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
- set_option_value((char_u *)"bl", 0L, NULL, OPT_LOCAL);
- set_option_value((char_u *)"bt", 0L,
- (char_u *)"nofile", OPT_LOCAL);
- set_option_value((char_u *)"bh", 0L,
- (char_u *)"wipe", OPT_LOCAL);
- set_option_value((char_u *)"diff", 0L,
- NULL, OPT_LOCAL);
+ set_option_value_give_err((char_u *)"swf",
+ 0L, NULL, OPT_LOCAL);
+ set_option_value_give_err((char_u *)"bl",
+ 0L, NULL, OPT_LOCAL);
+ set_option_value_give_err((char_u *)"bt",
+ 0L, (char_u *)"nofile", OPT_LOCAL);
+ set_option_value_give_err((char_u *)"bh",
+ 0L, (char_u *)"wipe", OPT_LOCAL);
+ set_option_value_give_err((char_u *)"diff",
+ 0L, NULL, OPT_LOCAL);
}
}
if (res == OK)
int is_hidden_option(int opt_idx);
int is_crypt_key_option(int opt_idx);
char *set_option_value(char_u *name, long number, char_u *string, int opt_flags);
+void set_option_value_give_err(char_u *name, long number, char_u *string, int opt_flags);
char_u *get_term_code(char_u *tname);
char_u *get_highlight_default(void);
char_u *get_encoding_default(void);
void set_iminsert_global(void);
void set_imsearch_global(void);
void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags);
-int ExpandSettings(expand_T *xp, regmatch_T *regmatch, char_u *pat, int *numMatches, char_u ***matches);
+int ExpandSettings(expand_T *xp, regmatch_T *regmatch, char_u *fuzzystr, int *numMatches, char_u ***matches);
int ExpandOldSetting(int *num_file, char_u ***file);
int shortmess(int x);
void vimrc_found(char_u *fname, char_u *envname);
qf_set_cwindow_options(void)
{
// switch off 'swapfile'
- set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
- set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix",
- OPT_LOCAL);
- set_option_value((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL);
+ set_option_value_give_err((char_u *)"swf", 0L, NULL, OPT_LOCAL);
+ set_option_value_give_err((char_u *)"bt",
+ 0L, (char_u *)"quickfix", OPT_LOCAL);
+ set_option_value_give_err((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL);
RESET_BINDING(curwin);
#ifdef FEAT_DIFF
curwin->w_p_diff = FALSE;
#endif
#ifdef FEAT_FOLDING
- set_option_value((char_u *)"fdm", 0L, (char_u *)"manual",
+ set_option_value_give_err((char_u *)"fdm", 0L, (char_u *)"manual",
OPT_LOCAL);
#endif
}
// This resembles reading a file into a buffer, it's more logical when
// using autocommands.
++curbuf_lock;
- set_option_value((char_u *)"ft", 0L, (char_u *)"qf", OPT_LOCAL);
+ set_option_value_give_err((char_u *)"ft",
+ 0L, (char_u *)"qf", OPT_LOCAL);
curbuf->b_p_ma = FALSE;
keep_filetype = TRUE; // don't detect 'filetype'
// Darn, some plugin changed the value. If it's still empty it was
// changed and restored, need to restore in the complicated way.
if (*p_cpo == NUL)
- set_option_value((char_u *)"cpo", 0L, save_cpo, 0);
+ set_option_value_give_err((char_u *)"cpo", 0L, save_cpo, 0);
if (save_cpo_allocated)
free_string_option(save_cpo);
}
STRCAT(new_rtp, afterdir);
}
- set_option_value((char_u *)"rtp", 0L, new_rtp, 0);
+ set_option_value_give_err((char_u *)"rtp", 0L, new_rtp, 0);
vim_free(new_rtp);
retval = OK;
}
}
}
- set_option_value((char_u *)"cpo", 0L, si->sn_save_cpo, OPT_NO_REDRAW);
+ set_option_value_give_err((char_u *)"cpo",
+ 0L, si->sn_save_cpo, OPT_NO_REDRAW);
}
VIM_CLEAR(si->sn_save_cpo);
/*
* Parse 'spelllang' and set w_s->b_langp accordingly.
- * Returns NULL if it's OK, an error message otherwise.
+ * Returns NULL if it's OK, an untranslated error message otherwise.
*/
char *
did_set_spelllang(win_T *wp)
do_cmdline_cmd((char_u *)"new");
// enable spelling locally in the new window
- set_option_value((char_u*)"spell", TRUE, (char_u*)"", OPT_LOCAL);
- set_option_value((char_u*)"spl", dummy, spl, OPT_LOCAL);
+ set_option_value_give_err((char_u*)"spell", TRUE, (char_u*)"", OPT_LOCAL);
+ set_option_value_give_err((char_u*)"spl", dummy, spl, OPT_LOCAL);
vim_free(spl);
if (!BUFEMPTY())
fname != NULL
&& strstr((char *)gettail(fname), ".ascii.") != NULL
? (char_u *)"ascii" : spell_enc());
- set_option_value((char_u *)"spellfile", 0L, buf, OPT_LOCAL);
+ set_option_value_give_err((char_u *)"spellfile",
+ 0L, buf, OPT_LOCAL);
break;
}
aspath = FALSE;
# endif
if (p != NULL)
{
- set_option_value((char_u *)"ttym", 0L, p, 0);
+ set_option_value_give_err((char_u *)"ttym", 0L, p, 0);
// Reset the WAS_SET flag, 'ttymouse' can be set to "sgr" or
// "xterm2" in check_termcode().
reset_option_was_set((char_u *)"ttym");
// Setting the option causes a screen redraw. Do
// that right away if possible, keeping any
// messages.
- set_option_value((char_u *)"ambw", 0L, (char_u *)aw, 0);
+ set_option_value_give_err((char_u *)"ambw", 0L, (char_u *)aw, 0);
# ifdef DEBUG_TERMRESPONSE
{
int r = redraw_asap(CLEAR);
&& (term_props[TPR_MOUSE].tpr_status == TPR_MOUSE_XTERM2
|| term_props[TPR_MOUSE].tpr_status == TPR_MOUSE_SGR))
{
- set_option_value((char_u *)"ttym", 0L,
+ set_option_value_give_err((char_u *)"ttym", 0L,
term_props[TPR_MOUSE].tpr_status == TPR_MOUSE_SGR
? (char_u *)"sgr" : (char_u *)"xterm2", 0);
}
&& STRCMP(p_bg, new_bg_val) != 0)
{
// value differs, apply it
- set_option_value((char_u *)"bg", 0L,
- (char_u *)new_bg_val, 0);
+ set_option_value_give_err((char_u *)"bg",
+ 0L, (char_u *)new_bg_val, 0);
reset_option_was_set((char_u *)"bg");
redraw_asap(CLEAR);
}
vim_free(file_name);
}
- set_option_value((char_u *)"undofile", 0L, NULL, OPT_LOCAL);
+ set_option_value_give_err((char_u *)"undofile", 0L, NULL, OPT_LOCAL);
}
#endif
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 4753,
/**/
4752,
/**/
if (STRCMP(p_cpo, CPO_VIM) != 0)
{
si->sn_save_cpo = vim_strsave(p_cpo);
- set_option_value((char_u *)"cpo", 0L, (char_u *)CPO_VIM, OPT_NO_REDRAW);
+ set_option_value_give_err((char_u *)"cpo",
+ 0L, (char_u *)CPO_VIM, OPT_NO_REDRAW);
}
#else
// No check for this being the first command, it doesn't matter.