mirror of
https://github.com/vim/vim.git
synced 2025-10-01 04:54:07 -04:00
patch 9.0.1115: code is indented more than needed
Problem: Code is indented more than needed. Solution: Use an early return to reduce indenting. (Yegappan Lakshmanan, closes #11758)
This commit is contained in:
committed by
Bram Moolenaar
parent
ef91ae4557
commit
ed0c1d5d4b
121
src/ex_cmds2.c
121
src/ex_cmds2.c
@@ -135,19 +135,19 @@ check_changed(buf_T *buf, int flags)
|
||||
void
|
||||
browse_save_fname(buf_T *buf)
|
||||
{
|
||||
if (buf->b_fname == NULL)
|
||||
{
|
||||
char_u *fname;
|
||||
if (buf->b_fname != NULL)
|
||||
return;
|
||||
|
||||
fname = do_browse(BROWSE_SAVE, (char_u *)_("Save As"),
|
||||
NULL, NULL, NULL, NULL, buf);
|
||||
if (fname != NULL)
|
||||
{
|
||||
if (setfname(buf, fname, NULL, TRUE) == OK)
|
||||
buf->b_flags |= BF_NOTEDITED;
|
||||
vim_free(fname);
|
||||
}
|
||||
}
|
||||
char_u *fname;
|
||||
|
||||
fname = do_browse(BROWSE_SAVE, (char_u *)_("Save As"),
|
||||
NULL, NULL, NULL, NULL, buf);
|
||||
if (fname == NULL)
|
||||
return;
|
||||
|
||||
if (setfname(buf, fname, NULL, TRUE) == OK)
|
||||
buf->b_flags |= BF_NOTEDITED;
|
||||
vim_free(fname);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -731,60 +731,59 @@ ex_compiler(exarg_T *eap)
|
||||
// List all compiler scripts.
|
||||
do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')");
|
||||
// ) keep the indenter happy...
|
||||
return;
|
||||
}
|
||||
|
||||
buf = alloc(STRLEN(eap->arg) + 14);
|
||||
if (buf == NULL)
|
||||
return;
|
||||
|
||||
if (eap->forceit)
|
||||
{
|
||||
// ":compiler! {name}" sets global options
|
||||
do_cmdline_cmd((char_u *)
|
||||
"command -nargs=* CompilerSet set <args>");
|
||||
}
|
||||
else
|
||||
{
|
||||
buf = alloc(STRLEN(eap->arg) + 14);
|
||||
if (buf != NULL)
|
||||
// ":compiler! {name}" sets local options.
|
||||
// To remain backwards compatible "current_compiler" is always
|
||||
// used. A user's compiler plugin may set it, the distributed
|
||||
// plugin will then skip the settings. Afterwards set
|
||||
// "b:current_compiler" and restore "current_compiler".
|
||||
// Explicitly prepend "g:" to make it work in a function.
|
||||
old_cur_comp = get_var_value((char_u *)"g:current_compiler");
|
||||
if (old_cur_comp != NULL)
|
||||
old_cur_comp = vim_strsave(old_cur_comp);
|
||||
do_cmdline_cmd((char_u *)
|
||||
"command -nargs=* -keepscript CompilerSet setlocal <args>");
|
||||
}
|
||||
do_unlet((char_u *)"g:current_compiler", TRUE);
|
||||
do_unlet((char_u *)"b:current_compiler", TRUE);
|
||||
|
||||
sprintf((char *)buf, "compiler/%s.vim", eap->arg);
|
||||
if (source_runtime(buf, DIP_ALL) == FAIL)
|
||||
semsg(_(e_compiler_not_supported_str), eap->arg);
|
||||
vim_free(buf);
|
||||
|
||||
do_cmdline_cmd((char_u *)":delcommand CompilerSet");
|
||||
|
||||
// Set "b:current_compiler" from "current_compiler".
|
||||
p = get_var_value((char_u *)"g:current_compiler");
|
||||
if (p != NULL)
|
||||
set_internal_string_var((char_u *)"b:current_compiler", p);
|
||||
|
||||
// Restore "current_compiler" for ":compiler {name}".
|
||||
if (!eap->forceit)
|
||||
{
|
||||
if (old_cur_comp != NULL)
|
||||
{
|
||||
if (eap->forceit)
|
||||
{
|
||||
// ":compiler! {name}" sets global options
|
||||
do_cmdline_cmd((char_u *)
|
||||
"command -nargs=* CompilerSet set <args>");
|
||||
}
|
||||
else
|
||||
{
|
||||
// ":compiler! {name}" sets local options.
|
||||
// To remain backwards compatible "current_compiler" is always
|
||||
// used. A user's compiler plugin may set it, the distributed
|
||||
// plugin will then skip the settings. Afterwards set
|
||||
// "b:current_compiler" and restore "current_compiler".
|
||||
// Explicitly prepend "g:" to make it work in a function.
|
||||
old_cur_comp = get_var_value((char_u *)"g:current_compiler");
|
||||
if (old_cur_comp != NULL)
|
||||
old_cur_comp = vim_strsave(old_cur_comp);
|
||||
do_cmdline_cmd((char_u *)
|
||||
"command -nargs=* -keepscript CompilerSet setlocal <args>");
|
||||
}
|
||||
do_unlet((char_u *)"g:current_compiler", TRUE);
|
||||
do_unlet((char_u *)"b:current_compiler", TRUE);
|
||||
|
||||
sprintf((char *)buf, "compiler/%s.vim", eap->arg);
|
||||
if (source_runtime(buf, DIP_ALL) == FAIL)
|
||||
semsg(_(e_compiler_not_supported_str), eap->arg);
|
||||
vim_free(buf);
|
||||
|
||||
do_cmdline_cmd((char_u *)":delcommand CompilerSet");
|
||||
|
||||
// Set "b:current_compiler" from "current_compiler".
|
||||
p = get_var_value((char_u *)"g:current_compiler");
|
||||
if (p != NULL)
|
||||
set_internal_string_var((char_u *)"b:current_compiler", p);
|
||||
|
||||
// Restore "current_compiler" for ":compiler {name}".
|
||||
if (!eap->forceit)
|
||||
{
|
||||
if (old_cur_comp != NULL)
|
||||
{
|
||||
set_internal_string_var((char_u *)"g:current_compiler",
|
||||
old_cur_comp);
|
||||
vim_free(old_cur_comp);
|
||||
}
|
||||
else
|
||||
do_unlet((char_u *)"g:current_compiler", TRUE);
|
||||
}
|
||||
set_internal_string_var((char_u *)"g:current_compiler",
|
||||
old_cur_comp);
|
||||
vim_free(old_cur_comp);
|
||||
}
|
||||
else
|
||||
do_unlet((char_u *)"g:current_compiler", TRUE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user