patch 8.2.0035: saving and restoring called_emsg is clumsy
Problem: Saving and restoring called_emsg is clumsy.
Solution: Count the number of error messages.
diff --git a/src/message.c b/src/message.c
index 522f7d6..2ea939f 100644
--- a/src/message.c
+++ b/src/message.c
@@ -581,7 +581,7 @@
#if !defined(HAVE_STRERROR) || defined(PROTO)
/*
* Replacement for perror() that behaves more or less like emsg() was called.
- * v:errmsg will be set and called_emsg will be set.
+ * v:errmsg will be set and called_emsg will be incremented.
*/
void
do_perror(char *msg)
@@ -620,7 +620,7 @@
return msg_use_printf() ? FALSE : msg((char *)s);
#endif
- called_emsg = TRUE;
+ ++called_emsg;
#ifdef FEAT_EVAL
// If "emsg_severe" is TRUE: When an error exception is to be thrown,