Patch 8.2.1927
Problem: Vim9: get unknown error with an error in a timer function.
Solution: Use did_emsg instead of called_emsg. (closes #7231)
Files: src/vim9compile.c, src/vim9execute.c
*** ../vim-8.2.1926/src/vim9compile.c 2020-10-28 14:31:11.646925147 +0100
--- src/vim9compile.c 2020-10-30 20:43:38.618424146 +0100
***************
*** 6998,7009 ****
char *errormsg = NULL; // error message
cctx_T cctx;
garray_T *instr;
! int called_emsg_before = called_emsg;
int ret = FAIL;
sctx_T save_current_sctx = current_sctx;
int save_estack_compiling = estack_compiling;
int do_estack_push;
- int emsg_before = called_emsg;
int new_def_function = FALSE;
// When using a function that was compiled before: Free old instructions.
--- 6998,7008 ----
char *errormsg = NULL; // error message
cctx_T cctx;
garray_T *instr;
! int did_emsg_before = did_emsg;
int ret = FAIL;
sctx_T save_current_sctx = current_sctx;
int save_estack_compiling = estack_compiling;
int do_estack_push;
int new_def_function = FALSE;
// When using a function that was compiled before: Free old instructions.
***************
*** 7107,7113 ****
// Bail out on the first error to avoid a flood of errors and report
// the right line number when inside try/catch.
! if (emsg_before != called_emsg)
goto erret;
if (line != NULL && *line == '|')
--- 7106,7112 ----
// Bail out on the first error to avoid a flood of errors and report
// the right line number when inside try/catch.
! if (did_emsg_before != did_emsg)
goto erret;
if (line != NULL && *line == '|')
***************
*** 7127,7133 ****
// beyond the last line
break;
}
- emsg_before = called_emsg;
CLEAR_FIELD(ea);
ea.cmdlinep = &line;
--- 7126,7131 ----
***************
*** 7585,7591 ****
if (errormsg != NULL)
emsg(errormsg);
! else if (called_emsg == called_emsg_before)
emsg(_(e_compiling_def_function_failed));
}
--- 7583,7589 ----
if (errormsg != NULL)
emsg(errormsg);
! else if (did_emsg == did_emsg_before)
emsg(_(e_compiling_def_function_failed));
}
*** ../vim-8.2.1926/src/vim9execute.c 2020-10-30 18:32:57.430698692 +0100
--- src/vim9execute.c 2020-10-30 20:30:16.267713927 +0100
***************
*** 828,834 ****
int defcount = ufunc->uf_args.ga_len - argc;
sctx_T save_current_sctx = current_sctx;
int breakcheck_count = 0;
! int called_emsg_before = called_emsg;
int save_suppress_errthrow = suppress_errthrow;
msglist_T **saved_msg_list = NULL;
msglist_T *private_msg_list = NULL;
--- 828,834 ----
int defcount = ufunc->uf_args.ga_len - argc;
sctx_T save_current_sctx = current_sctx;
int breakcheck_count = 0;
! int did_emsg_before = did_emsg;
int save_suppress_errthrow = suppress_errthrow;
msglist_T **saved_msg_list = NULL;
msglist_T *private_msg_list = NULL;
***************
*** 853,859 ****
|| (ufunc->uf_def_status == UF_TO_BE_COMPILED
&& compile_def_function(ufunc, FALSE, NULL) == FAIL))
{
! if (called_emsg == called_emsg_before)
semsg(_(e_function_is_not_compiled_str),
printable_func_name(ufunc));
return FAIL;
--- 853,859 ----
|| (ufunc->uf_def_status == UF_TO_BE_COMPILED
&& compile_def_function(ufunc, FALSE, NULL) == FAIL))
{
! if (did_emsg == did_emsg_before)
semsg(_(e_function_is_not_compiled_str),
printable_func_name(ufunc));
return FAIL;
***************
*** 2924,2930 ****
// Not sure if this is necessary.
suppress_errthrow = save_suppress_errthrow;
! if (ret != OK && called_emsg == called_emsg_before)
semsg(_(e_unknown_error_while_executing_str),
printable_func_name(ufunc));
return ret;
--- 2924,2930 ----
// Not sure if this is necessary.
suppress_errthrow = save_suppress_errthrow;
! if (ret != OK && did_emsg == did_emsg_before)
semsg(_(e_unknown_error_while_executing_str),
printable_func_name(ufunc));
return ret;
*** ../vim-8.2.1926/src/version.c 2020-10-30 19:25:06.829693344 +0100
--- src/version.c 2020-10-30 20:44:49.342295902 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1927,
/**/
--
hundred-and-one symptoms of being an internet addict:
160. You get in the elevator and double-click the button for the floor
you want.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202010301950.09UJoYTS2799960%40masaka.moolenaar.net.