Patch 9.0.0079
Problem: Error in autoload script not reported for 'foldexpr'.
Solution: Reset "emsg_off" when auto-loading a script. (closes #10685)
Files: src/vim9compile.c, src/testdir/test_vim9_script.vim
*** ../vim-9.0.0078/src/vim9compile.c 2022-05-26 21:38:51.000000000 +0100
--- src/vim9compile.c 2022-07-26 15:03:55.887040312 +0100
***************
*** 610,621 ****
ret = find_imported_in_script(name, len, current_sctx.sc_sid);
if (ret != NULL && load && (ret->imp_flags & IMP_FLAGS_AUTOLOAD))
{
! scid_T dummy;
// script found before but not loaded yet
ret->imp_flags &= ~IMP_FLAGS_AUTOLOAD;
(void)do_source(SCRIPT_ITEM(ret->imp_sid)->sn_name, FALSE,
DOSO_NONE, &dummy);
}
return ret;
}
--- 610,629 ----
ret = find_imported_in_script(name, len, current_sctx.sc_sid);
if (ret != NULL && load && (ret->imp_flags & IMP_FLAGS_AUTOLOAD))
{
! 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
ret->imp_flags &= ~IMP_FLAGS_AUTOLOAD;
(void)do_source(SCRIPT_ITEM(ret->imp_sid)->sn_name, FALSE,
DOSO_NONE, &dummy);
+
+ emsg_off = save_emsg_off;
}
return ret;
}
*** ../vim-9.0.0078/src/testdir/test_vim9_script.vim 2022-05-17 16:10:02.000000000 +0100
--- src/testdir/test_vim9_script.vim 2022-07-26 15:08:44.133960819 +0100
***************
*** 3440,3445 ****
--- 3440,3469 ----
delete(dir, 'rf')
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()
assert_fails('func <SNR>1234_func', 'E123:')
*** ../vim-9.0.0078/src/version.c 2022-07-26 14:44:33.629670409 +0100
--- src/version.c 2022-07-26 15:04:58.210785980 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 79,
/**/
--
Birthdays are healthy. The more you have them, the longer you live.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///