Patch 8.0.0663
Problem:    Giving an error message only when 'verbose' set is unexpected.
Solution:   Give a warning message instead.
Files:      src/message.c, src/proto/message.pro, src/userfunc.c,
            src/testdir/test_vimscript.vim, runtime/doc/eval.txt


*** ../vim-8.0.0662/src/message.c       2017-03-29 17:30:23.160136913 +0200
--- src/message.c       2017-06-23 20:13:03.469558788 +0200
***************
*** 3471,3476 ****
--- 3471,3483 ----
      --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".
   */
*** ../vim-8.0.0662/src/proto/message.pro       2017-03-16 19:58:19.416253412 
+0100
--- src/proto/message.pro       2017-06-23 20:18:12.499145273 +0200
***************
*** 75,80 ****
--- 75,81 ----
  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);
*** ../vim-8.0.0662/src/userfunc.c      2017-06-22 19:15:20.161602227 +0200
--- src/userfunc.c      2017-06-23 20:16:09.284109760 +0200
***************
*** 2137,2143 ****
                    /* 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);
                if (line_arg == NULL)
                    vim_free(theline);
                break;
--- 2137,2145 ----
                    /* Another command follows. */
                    eap->nextcmd = line_arg;
                else if (*p != NUL && *p != '"' && p_verbose > 0)
!                   give_warning2(
!                        (char_u *)_("W22: Text found after :endfunction: %s"),
!                        p, TRUE);
                if (line_arg == NULL)
                    vim_free(theline);
                break;
*** ../vim-8.0.0662/src/testdir/test_vimscript.vim      2017-06-22 
20:39:13.393435240 +0200
--- src/testdir/test_vimscript.vim      2017-06-23 20:18:09.843166059 +0200
***************
*** 1381,1390 ****
  
      set verbose=1
      exe "func Xtest()\necho 'hello'\nendfunc \" garbage"
      call assert_true(exists('*Xtest'))
      delfunc Xtest
  
!     call assert_fails("func Xtest()\necho 'hello'\nendfunc garbage", 'E946')
      call assert_true(exists('*Xtest'))
      delfunc Xtest
      set verbose=0
--- 1381,1392 ----
  
      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
  
!     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
*** ../vim-8.0.0662/runtime/doc/eval.txt        2017-06-22 22:00:46.410155731 
+0200
--- runtime/doc/eval.txt        2017-06-23 20:28:34.850278578 +0200
***************
*** 8714,8719 ****
--- 8722,8730 ----
                        not used an error message is given.  When [!] is used,
                        an existing function is silently replaced.  Unless it
                        is currently being executed, that is an error.
+                       NOTE: Use ! wisely.  If used without care it can cause
+                       an existing function to be replaced unexpectedly,
+                       which is hard to debug.
  
                        For the {arguments} see |function-argument|.
  
***************
*** 8763,8769 ****
                        implies that the effect of |:nohlsearch| is undone
                        when the function returns.
  
!                               *:endf* *:endfunction* *E126* *E193* *E946*
  :endf[unction] [argument]
                        The end of a function definition.  Best is to put it
                        on a line by its own, without [argument].
--- 8774,8780 ----
                        implies that the effect of |:nohlsearch| is undone
                        when the function returns.
  
!                               *:endf* *:endfunction* *E126* *E193* *W22*
  :endf[unction] [argument]
                        The end of a function definition.  Best is to put it
                        on a line by its own, without [argument].
***************
*** 8772,8783 ****
                                | command       command to execute next
                                \n command      command to execute next
                                " comment       always ignored
!                               anything else   ignored, unless 'verbose' is
!                                               non-zero
                        The support for a following command was added in Vim
                        8.0.0654, before that any argument was silently
                        ignored.
  
                                *:delf* *:delfunction* *E130* *E131* *E933*
  :delf[unction][!] {name}
                        Delete function {name}.
--- 8783,8798 ----
                                | command       command to execute next
                                \n command      command to execute next
                                " comment       always ignored
!                               anything else   ignored, warning given when
!                                               'verbose' is non-zero
                        The support for a following command was added in Vim
                        8.0.0654, before that any argument was silently
                        ignored.
  
+                       To be able to define a function inside an `:execute`
+                       command, use line breaks instead of |:bar|: >
+                               :exe "func Foo()\necho 'foo'\nendfunc"
+ <
                                *:delf* *:delfunction* *E130* *E131* *E933*
  :delf[unction][!] {name}
                        Delete function {name}.
*** ../vim-8.0.0662/src/version.c       2017-06-22 23:03:08.492157678 +0200
--- src/version.c       2017-06-23 20:49:45.784361578 +0200
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     663,
  /**/

-- 
"Thou shalt not follow the Null Pointer, for at its end Chaos and
Madness lie."

 /// 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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui