/*
* Evaluate an expression that the client sent to a string.
- * Handles disabling error messages and disables debugging, otherwise Vim
- * hangs, waiting for "cont" to be typed.
*/
char_u *
eval_client_expr_to_string(expr)
int save_dbl = debug_break_level;
int save_ro = redir_off;
+ /* Disable debugging, otherwise Vim hangs, waiting for "cont" to be
+ * typed. */
debug_break_level = -1;
redir_off = 0;
- ++emsg_skip;
+ /* Do not display error message, otherwise Vim hangs, waiting for "cont"
+ * to be typed. Do generate errors so that try/catch works. */
+ ++emsg_silent;
res = eval_to_string(expr, NULL, TRUE);
debug_break_level = save_dbl;
redir_off = save_ro;
- --emsg_skip;
+ --emsg_silent;
+ if (emsg_silent < 0)
+ emsg_silent = 0;
/* A client can tell us to redraw, but not to display the cursor, so do
* that here. */