mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 9.0.0079: error in autoload script not reported for 'foldexpr'
Problem: Error in autoload script not reported for 'foldexpr'. Solution: Reset "emsg_off" when auto-loading a script. (closes #10685)
This commit is contained in:
@@ -3440,6 +3440,30 @@ def Test_error_in_autoload_script()
|
|||||||
delete(dir, 'rf')
|
delete(dir, 'rf')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_error_in_autoload_script_foldexpr()
|
||||||
|
var save_rtp = &rtp
|
||||||
|
mkdir('Xvim/autoload', 'p')
|
||||||
|
&runtimepath = 'Xvim'
|
||||||
|
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
eval [][0]
|
||||||
|
echomsg 'no error'
|
||||||
|
END
|
||||||
|
lines->writefile('Xvim/autoload/script.vim')
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
import autoload 'script.vim'
|
||||||
|
&foldmethod = 'expr'
|
||||||
|
&foldexpr = 'script.Func()'
|
||||||
|
redraw
|
||||||
|
END
|
||||||
|
v9.CheckScriptFailure(lines, 'E684: List index out of range: 0')
|
||||||
|
|
||||||
|
delete('Xvim', 'rf')
|
||||||
|
enddef
|
||||||
|
|
||||||
def Test_invalid_sid()
|
def Test_invalid_sid()
|
||||||
assert_fails('func <SNR>1234_func', 'E123:')
|
assert_fails('func <SNR>1234_func', 'E123:')
|
||||||
|
|
||||||
|
@@ -735,6 +735,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
79,
|
||||||
/**/
|
/**/
|
||||||
78,
|
78,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -610,12 +610,20 @@ find_imported(char_u *name, size_t len, int load)
|
|||||||
ret = find_imported_in_script(name, len, current_sctx.sc_sid);
|
ret = find_imported_in_script(name, len, current_sctx.sc_sid);
|
||||||
if (ret != NULL && load && (ret->imp_flags & IMP_FLAGS_AUTOLOAD))
|
if (ret != NULL && load && (ret->imp_flags & IMP_FLAGS_AUTOLOAD))
|
||||||
{
|
{
|
||||||
scid_T dummy;
|
scid_T dummy;
|
||||||
|
int save_emsg_off = emsg_off;
|
||||||
|
|
||||||
|
// "emsg_off" will be set when evaluating an expression silently, but
|
||||||
|
// we do want to know about errors in a script. Also because it then
|
||||||
|
// aborts when an error is encountered.
|
||||||
|
emsg_off = FALSE;
|
||||||
|
|
||||||
// script found before but not loaded yet
|
// script found before but not loaded yet
|
||||||
ret->imp_flags &= ~IMP_FLAGS_AUTOLOAD;
|
ret->imp_flags &= ~IMP_FLAGS_AUTOLOAD;
|
||||||
(void)do_source(SCRIPT_ITEM(ret->imp_sid)->sn_name, FALSE,
|
(void)do_source(SCRIPT_ITEM(ret->imp_sid)->sn_name, FALSE,
|
||||||
DOSO_NONE, &dummy);
|
DOSO_NONE, &dummy);
|
||||||
|
|
||||||
|
emsg_off = save_emsg_off;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user