4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: When a script is run with ":silent" it is not able to give warning
13 Solution: Add the ":unsilent" command.
14 Files: runtime/doc/various.txt, src/ex_cmds.h, src/ex_docmd.c
17 *** ../vim-7.2.222/runtime/doc/various.txt 2008-08-09 19:36:54.000000000 +0200
18 --- runtime/doc/various.txt 2009-07-09 15:52:54.000000000 +0200
22 messages though. Use ":silent" in the command itself
23 to avoid that: ":silent menu .... :silent command".
26 + :uns[ilent] {command} Execute {command} not silently. Only makes a
27 + difference when |:silent| was used to get to this
29 + Use this for giving a message even when |:silent| was
30 + used. In this example |:silent| is used to avoid the
31 + message about reading the file and |:unsilent| to be
32 + able to list the first line of each file. >
33 + :silent argdo unsilent echo expand('%') . ": " . getline(1)
37 :[count]verb[ose] {command}
38 Execute {command} with 'verbose' set to [count]. If
39 *** ../vim-7.2.222/src/ex_cmds.h 2008-11-09 13:43:25.000000000 +0100
40 --- src/ex_cmds.h 2009-07-01 18:12:55.000000000 +0200
44 BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
45 EX(CMD_unmenu, "unmenu", ex_menu,
46 BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
47 + EX(CMD_unsilent, "unsilent", ex_wrongmodifier,
48 + NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
49 EX(CMD_update, "update", ex_update,
50 RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR),
51 EX(CMD_vglobal, "vglobal", ex_global,
52 *** ../vim-7.2.222/src/ex_docmd.c 2009-07-01 20:18:43.000000000 +0200
53 --- src/ex_docmd.c 2009-07-09 15:24:03.000000000 +0200
56 char_u *errormsg = NULL; /* error message */
57 exarg_T ea; /* Ex command arguments */
58 long verbose_save = -1;
59 ! int save_msg_scroll = 0;
63 int did_sandbox = FALSE;
65 char_u *errormsg = NULL; /* error message */
66 exarg_T ea; /* Ex command arguments */
67 long verbose_save = -1;
68 ! int save_msg_scroll = msg_scroll;
69 ! int save_msg_silent = -1;
72 int did_sandbox = FALSE;
76 if (!checkforcmd(&ea.cmd, "silent", 3))
80 - save_msg_scroll = msg_scroll;
81 if (*ea.cmd == '!' && !vim_iswhite(ea.cmd[-1]))
83 /* ":silent!", but not "silent !cmd" */
86 if (!checkforcmd(&ea.cmd, "silent", 3))
88 ! if (save_msg_silent == -1)
89 ! save_msg_silent = msg_silent;
91 if (*ea.cmd == '!' && !vim_iswhite(ea.cmd[-1]))
93 /* ":silent!", but not "silent !cmd" */
100 + case 'u': if (!checkforcmd(&ea.cmd, "unsilent", 3))
102 + if (save_msg_silent == -1)
103 + save_msg_silent = msg_silent;
107 case 'v': if (checkforcmd(&ea.cmd, "vertical", 4))
109 #ifdef FEAT_VERTSPLIT
113 cmdmod = save_cmdmod;
115 ! if (did_silent > 0)
117 /* messages could be enabled for a serious error, need to check if the
118 * counters don't become negative */
119 ! msg_silent -= did_silent;
120 ! if (msg_silent < 0)
122 emsg_silent -= did_esilent;
127 cmdmod = save_cmdmod;
129 ! if (save_msg_silent != -1)
131 /* messages could be enabled for a serious error, need to check if the
132 * counters don't become negative */
134 ! msg_silent = save_msg_silent;
135 emsg_silent -= did_esilent;
141 {"silent", 3, FALSE},
143 {"topleft", 2, FALSE},
144 + {"unsilent", 3, FALSE},
145 {"verbose", 4, TRUE},
146 {"vertical", 4, FALSE},
148 *** ../vim-7.2.222/src/version.c 2009-07-01 20:18:43.000000000 +0200
149 --- src/version.c 2009-07-09 15:53:05.000000000 +0200
153 { /* Add new patch number below this line */
159 Q: How many legs does a giraffe have?
160 A: Eight: two in front, two behind, two on the left and two on the right
162 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
163 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
164 \\\ download, build and distribute -- http://www.A-A-P.org ///
165 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///