81c2858
To: vim-dev@vim.org
81c2858
Subject: Patch 7.2.223
81c2858
Fcc: outbox
81c2858
From: Bram Moolenaar <Bram@moolenaar.net>
81c2858
Mime-Version: 1.0
81c2858
Content-Type: text/plain; charset=UTF-8
81c2858
Content-Transfer-Encoding: 8bit
81c2858
------------
81c2858
81c2858
Patch 7.2.223
81c2858
Problem:    When a script is run with ":silent" it is not able to give warning
81c2858
	    messages.
81c2858
Solution:   Add the ":unsilent" command.
81c2858
Files:	    runtime/doc/various.txt, src/ex_cmds.h, src/ex_docmd.c
81c2858
81c2858
81c2858
*** ../vim-7.2.222/runtime/doc/various.txt	2008-08-09 19:36:54.000000000 +0200
81c2858
--- runtime/doc/various.txt	2009-07-09 15:52:54.000000000 +0200
81c2858
***************
81c2858
*** 508,513 ****
81c2858
--- 508,524 ----
81c2858
  			messages though.  Use ":silent" in the command itself
81c2858
  			to avoid that: ":silent menu .... :silent command".
81c2858
  
81c2858
+ 						*:uns* *:unsilent*
81c2858
+ :uns[ilent] {command}	Execute {command} not silently.  Only makes a
81c2858
+ 			difference when |:silent| was used to get to this
81c2858
+ 			command.
81c2858
+ 			Use this for giving a message even when |:silent| was
81c2858
+ 			used.  In this example |:silent| is used to avoid the
81c2858
+ 			message about reading the file and |:unsilent| to be
81c2858
+ 			able to list the first line of each file. >
81c2858
+     		:silent argdo unsilent echo expand('%') . ": " . getline(1)
81c2858
+ <
81c2858
+ 
81c2858
  						*:verb* *:verbose*
81c2858
  :[count]verb[ose] {command}
81c2858
  			Execute {command} with 'verbose' set to [count].  If
81c2858
*** ../vim-7.2.222/src/ex_cmds.h	2008-11-09 13:43:25.000000000 +0100
81c2858
--- src/ex_cmds.h	2009-07-01 18:12:55.000000000 +0200
81c2858
***************
81c2858
*** 991,996 ****
81c2858
--- 991,998 ----
81c2858
  			BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
81c2858
  EX(CMD_unmenu,		"unmenu",	ex_menu,
81c2858
  			BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
81c2858
+ EX(CMD_unsilent,	"unsilent",	ex_wrongmodifier,
81c2858
+ 			NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
81c2858
  EX(CMD_update,		"update",	ex_update,
81c2858
  			RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR),
81c2858
  EX(CMD_vglobal,		"vglobal",	ex_global,
81c2858
*** ../vim-7.2.222/src/ex_docmd.c	2009-07-01 20:18:43.000000000 +0200
81c2858
--- src/ex_docmd.c	2009-07-09 15:24:03.000000000 +0200
81c2858
***************
81c2858
*** 1677,1684 ****
81c2858
      char_u		*errormsg = NULL;	/* error message */
81c2858
      exarg_T		ea;			/* Ex command arguments */
81c2858
      long		verbose_save = -1;
81c2858
!     int			save_msg_scroll = 0;
81c2858
!     int			did_silent = 0;
81c2858
      int			did_esilent = 0;
81c2858
  #ifdef HAVE_SANDBOX
81c2858
      int			did_sandbox = FALSE;
81c2858
--- 1677,1684 ----
81c2858
      char_u		*errormsg = NULL;	/* error message */
81c2858
      exarg_T		ea;			/* Ex command arguments */
81c2858
      long		verbose_save = -1;
81c2858
!     int			save_msg_scroll = msg_scroll;
81c2858
!     int			save_msg_silent = -1;
81c2858
      int			did_esilent = 0;
81c2858
  #ifdef HAVE_SANDBOX
81c2858
      int			did_sandbox = FALSE;
81c2858
***************
81c2858
*** 1856,1864 ****
81c2858
  			}
81c2858
  			if (!checkforcmd(&ea.cmd, "silent", 3))
81c2858
  			    break;
81c2858
! 			++did_silent;
81c2858
  			++msg_silent;
81c2858
- 			save_msg_scroll = msg_scroll;
81c2858
  			if (*ea.cmd == '!' && !vim_iswhite(ea.cmd[-1]))
81c2858
  			{
81c2858
  			    /* ":silent!", but not "silent !cmd" */
81c2858
--- 1856,1864 ----
81c2858
  			}
81c2858
  			if (!checkforcmd(&ea.cmd, "silent", 3))
81c2858
  			    break;
81c2858
! 			if (save_msg_silent == -1)
81c2858
! 			    save_msg_silent = msg_silent;
81c2858
  			++msg_silent;
81c2858
  			if (*ea.cmd == '!' && !vim_iswhite(ea.cmd[-1]))
81c2858
  			{
81c2858
  			    /* ":silent!", but not "silent !cmd" */
81c2858
***************
81c2858
*** 1886,1891 ****
81c2858
--- 1886,1898 ----
81c2858
  #endif
81c2858
  			continue;
81c2858
  
81c2858
+ 	    case 'u':	if (!checkforcmd(&ea.cmd, "unsilent", 3))
81c2858
+ 			    break;
81c2858
+ 			if (save_msg_silent == -1)
81c2858
+ 			    save_msg_silent = msg_silent;
81c2858
+ 			msg_silent = 0;
81c2858
+ 			continue;
81c2858
+ 
81c2858
  	    case 'v':	if (checkforcmd(&ea.cmd, "vertical", 4))
81c2858
  			{
81c2858
  #ifdef FEAT_VERTSPLIT
81c2858
***************
81c2858
*** 2684,2696 ****
81c2858
  
81c2858
      cmdmod = save_cmdmod;
81c2858
  
81c2858
!     if (did_silent > 0)
81c2858
      {
81c2858
  	/* messages could be enabled for a serious error, need to check if the
81c2858
  	 * counters don't become negative */
81c2858
! 	msg_silent -= did_silent;
81c2858
! 	if (msg_silent < 0)
81c2858
! 	    msg_silent = 0;
81c2858
  	emsg_silent -= did_esilent;
81c2858
  	if (emsg_silent < 0)
81c2858
  	    emsg_silent = 0;
81c2858
--- 2691,2702 ----
81c2858
  
81c2858
      cmdmod = save_cmdmod;
81c2858
  
81c2858
!     if (save_msg_silent != -1)
81c2858
      {
81c2858
  	/* messages could be enabled for a serious error, need to check if the
81c2858
  	 * counters don't become negative */
81c2858
! 	if (!did_emsg)
81c2858
! 	    msg_silent = save_msg_silent;
81c2858
  	emsg_silent -= did_esilent;
81c2858
  	if (emsg_silent < 0)
81c2858
  	    emsg_silent = 0;
81c2858
***************
81c2858
*** 2987,2992 ****
81c2858
--- 2993,2999 ----
81c2858
      {"silent", 3, FALSE},
81c2858
      {"tab", 3, TRUE},
81c2858
      {"topleft", 2, FALSE},
81c2858
+     {"unsilent", 3, FALSE},
81c2858
      {"verbose", 4, TRUE},
81c2858
      {"vertical", 4, FALSE},
81c2858
  };
81c2858
*** ../vim-7.2.222/src/version.c	2009-07-01 20:18:43.000000000 +0200
81c2858
--- src/version.c	2009-07-09 15:53:05.000000000 +0200
81c2858
***************
81c2858
*** 678,679 ****
81c2858
--- 678,681 ----
81c2858
  {   /* Add new patch number below this line */
81c2858
+ /**/
81c2858
+     223,
81c2858
  /**/
81c2858
81c2858
-- 
81c2858
Q: How many legs does a giraffe have?
81c2858
A: Eight: two in front, two behind, two on the left and two on the right
81c2858
81c2858
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
81c2858
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
81c2858
\\\        download, build and distribute -- http://www.A-A-P.org        ///
81c2858
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///