patch 8.0.0663: unexpected error message only when 'verbose' is set
Problem: Giving an error message only when 'verbose' set is unexpected.
Solution: Give a warning message instead.
diff --git a/src/message.c b/src/message.c
index a9a6669..aeceee1 100644
--- a/src/message.c
+++ b/src/message.c
@@ -3471,6 +3471,13 @@
--no_wait_return;
}
+ void
+give_warning2(char_u *message, char_u *a1, int hl)
+{
+ vim_snprintf((char *)IObuff, IOSIZE, (char *)message, a1);
+ give_warning(IObuff, hl);
+}
+
/*
* Advance msg cursor to column "col".
*/
diff --git a/src/proto/message.pro b/src/proto/message.pro
index 8d9ac71..f8b6f68 100644
--- a/src/proto/message.pro
+++ b/src/proto/message.pro
@@ -75,6 +75,7 @@
void verbose_stop(void);
int verbose_open(void);
void give_warning(char_u *message, int hl);
+void give_warning2(char_u *message, char_u *a1, int hl);
void msg_advance(int col);
int do_dialog(int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield, int ex_cmd);
void display_confirm_msg(void);
diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim
index c0736f2..13b32cd 100644
--- a/src/testdir/test_vimscript.vim
+++ b/src/testdir/test_vimscript.vim
@@ -1381,10 +1381,12 @@
set verbose=1
exe "func Xtest()\necho 'hello'\nendfunc \" garbage"
+ call assert_notmatch('W22:', split(execute('1messages'), "\n")[0])
call assert_true(exists('*Xtest'))
delfunc Xtest
- call assert_fails("func Xtest()\necho 'hello'\nendfunc garbage", 'E946')
+ exe "func Xtest()\necho 'hello'\nendfunc garbage"
+ call assert_match('W22:', split(execute('1messages'), "\n")[0])
call assert_true(exists('*Xtest'))
delfunc Xtest
set verbose=0
diff --git a/src/userfunc.c b/src/userfunc.c
index 34da2ef..dfd7fcc 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -2137,7 +2137,9 @@
/* Another command follows. */
eap->nextcmd = line_arg;
else if (*p != NUL && *p != '"' && p_verbose > 0)
- EMSG2((char_u *)_("E946: Text found after :endfunction: %s"), p);
+ give_warning2(
+ (char_u *)_("W22: Text found after :endfunction: %s"),
+ p, TRUE);
if (line_arg == NULL)
vim_free(theline);
break;
diff --git a/src/version.c b/src/version.c
index ab7a929..102e388 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 663,
+/**/
662,
/**/
661,