Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.2.223
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.2.223
Problem:    When a script is run with ":silent" it is not able to give warning
	    messages.
Solution:   Add the ":unsilent" command.
Files:	    runtime/doc/various.txt, src/ex_cmds.h, src/ex_docmd.c


*** ../vim-7.2.222/runtime/doc/various.txt	2008-08-09 19:36:54.000000000 +0200
--- runtime/doc/various.txt	2009-07-09 15:52:54.000000000 +0200
***************
*** 508,513 ****
--- 508,524 ----
  			messages though.  Use ":silent" in the command itself
  			to avoid that: ":silent menu .... :silent command".
  
+ 						*:uns* *:unsilent*
+ :uns[ilent] {command}	Execute {command} not silently.  Only makes a
+ 			difference when |:silent| was used to get to this
+ 			command.
+ 			Use this for giving a message even when |:silent| was
+ 			used.  In this example |:silent| is used to avoid the
+ 			message about reading the file and |:unsilent| to be
+ 			able to list the first line of each file. >
+     		:silent argdo unsilent echo expand('%') . ": " . getline(1)
+ <
+ 
  						*:verb* *:verbose*
  :[count]verb[ose] {command}
  			Execute {command} with 'verbose' set to [count].  If
*** ../vim-7.2.222/src/ex_cmds.h	2008-11-09 13:43:25.000000000 +0100
--- src/ex_cmds.h	2009-07-01 18:12:55.000000000 +0200
***************
*** 991,996 ****
--- 991,998 ----
  			BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
  EX(CMD_unmenu,		"unmenu",	ex_menu,
  			BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
+ EX(CMD_unsilent,	"unsilent",	ex_wrongmodifier,
+ 			NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
  EX(CMD_update,		"update",	ex_update,
  			RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR),
  EX(CMD_vglobal,		"vglobal",	ex_global,
*** ../vim-7.2.222/src/ex_docmd.c	2009-07-01 20:18:43.000000000 +0200
--- src/ex_docmd.c	2009-07-09 15:24:03.000000000 +0200
***************
*** 1677,1684 ****
      char_u		*errormsg = NULL;	/* error message */
      exarg_T		ea;			/* Ex command arguments */
      long		verbose_save = -1;
!     int			save_msg_scroll = 0;
!     int			did_silent = 0;
      int			did_esilent = 0;
  #ifdef HAVE_SANDBOX
      int			did_sandbox = FALSE;
--- 1677,1684 ----
      char_u		*errormsg = NULL;	/* error message */
      exarg_T		ea;			/* Ex command arguments */
      long		verbose_save = -1;
!     int			save_msg_scroll = msg_scroll;
!     int			save_msg_silent = -1;
      int			did_esilent = 0;
  #ifdef HAVE_SANDBOX
      int			did_sandbox = FALSE;
***************
*** 1856,1864 ****
  			}
  			if (!checkforcmd(&ea.cmd, "silent", 3))
  			    break;
! 			++did_silent;
  			++msg_silent;
- 			save_msg_scroll = msg_scroll;
  			if (*ea.cmd == '!' && !vim_iswhite(ea.cmd[-1]))
  			{
  			    /* ":silent!", but not "silent !cmd" */
--- 1856,1864 ----
  			}
  			if (!checkforcmd(&ea.cmd, "silent", 3))
  			    break;
! 			if (save_msg_silent == -1)
! 			    save_msg_silent = msg_silent;
  			++msg_silent;
  			if (*ea.cmd == '!' && !vim_iswhite(ea.cmd[-1]))
  			{
  			    /* ":silent!", but not "silent !cmd" */
***************
*** 1886,1891 ****
--- 1886,1898 ----
  #endif
  			continue;
  
+ 	    case 'u':	if (!checkforcmd(&ea.cmd, "unsilent", 3))
+ 			    break;
+ 			if (save_msg_silent == -1)
+ 			    save_msg_silent = msg_silent;
+ 			msg_silent = 0;
+ 			continue;
+ 
  	    case 'v':	if (checkforcmd(&ea.cmd, "vertical", 4))
  			{
  #ifdef FEAT_VERTSPLIT
***************
*** 2684,2696 ****
  
      cmdmod = save_cmdmod;
  
!     if (did_silent > 0)
      {
  	/* messages could be enabled for a serious error, need to check if the
  	 * counters don't become negative */
! 	msg_silent -= did_silent;
! 	if (msg_silent < 0)
! 	    msg_silent = 0;
  	emsg_silent -= did_esilent;
  	if (emsg_silent < 0)
  	    emsg_silent = 0;
--- 2691,2702 ----
  
      cmdmod = save_cmdmod;
  
!     if (save_msg_silent != -1)
      {
  	/* messages could be enabled for a serious error, need to check if the
  	 * counters don't become negative */
! 	if (!did_emsg)
! 	    msg_silent = save_msg_silent;
  	emsg_silent -= did_esilent;
  	if (emsg_silent < 0)
  	    emsg_silent = 0;
***************
*** 2987,2992 ****
--- 2993,2999 ----
      {"silent", 3, FALSE},
      {"tab", 3, TRUE},
      {"topleft", 2, FALSE},
+     {"unsilent", 3, FALSE},
      {"verbose", 4, TRUE},
      {"vertical", 4, FALSE},
  };
*** ../vim-7.2.222/src/version.c	2009-07-01 20:18:43.000000000 +0200
--- src/version.c	2009-07-09 15:53:05.000000000 +0200
***************
*** 678,679 ****
--- 678,681 ----
  {   /* Add new patch number below this line */
+ /**/
+     223,
  /**/

-- 
Q: How many legs does a giraffe have?
A: Eight: two in front, two behind, two on the left and two on the right

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///