Bug:silent command make vim stay in silent mode and no further command can be seen

35 views
Skip to first unread message

dr-dr xp

unread,
Sep 29, 2009, 12:40:52 PM9/29/09
to vim...@googlegroups.com

----- code -----
func! s:foo()
   throw 'exception'
endfunc

func! Foo()
   try
       silent s:foo()
   catch
       " nop.
   endtry
endfunc
----- code -----

":call Foo()" makes Vim stay 'silent mode'

After this, :some_command can work fine, but nothing shown in command-line as typing.
This bug occurs in this version:  http://sourceforge.net/projects/cream/files/Vim/7.2.259/gvim-7-2-259.exe/download

--
要了几天饱饭就不记得西北风啥味了

Andy Wokula

unread,
Sep 29, 2009, 12:51:43 PM9/29/09
to vim...@googlegroups.com
dr-dr xp schrieb:

> ----- code -----
> func! s:foo()
> throw 'exception'
> endfunc
>
> func! Foo()
> try
> silent s:foo()

do you mean:
:silent call s:foo()

> catch
> " nop.
> endtry
> endfunc
> ----- code -----
>
> ":call Foo()" makes Vim stay 'silent mode'
>
> After this, :some_command can work fine, but nothing shown in command-line
> as typing.
> This bug occurs in this version:
> http://sourceforge.net/projects/cream/files/Vim/7.2.259/gvim-7-2-259.exe/download

nothing unusual here (gVim 7.2.218) ...

--
Andy

dr-dr xp

unread,
Sep 29, 2009, 11:48:20 PM9/29/09
to vim...@googlegroups.com
I didn't get this bug either, I use the standard gvim7.2 .

Bug several people reported this bug in using xpt http://www.vim.org/scripts/script.php?script_id=2611  version 0.3.9.4,

Seems in the latest patched version 7.2.264 there still be this bug existed.



reference:
http://groups.google.com/group/xptemplate/browse_thread/thread/a55134d70ef3f29c

tyru

unread,
Sep 29, 2009, 7:46:10 PM9/29/09
to vim_dev
> do you mean:
>     :silent call s:foo()

":silent s:foo()" works on my environment.
and that causes hidden command line.
I tested

- Vim 7.2 included patches 1-264
- 7.0 included patches 1, 3-4, 7-9, 11, 13-17, 19-26, 29-31, 34-44,
47, 50-56, 58-64, 66-73, 75, 77-92, 94-107, 109, 202, 234-235, 237

but that happens only in Vim 7.2.


On Sep 30, 1:51 am, Andy Wokula <anw...@yahoo.de> wrote:
> dr-dr xp schrieb:
>
> > ----- code -----
> > func! s:foo()
> >    throw 'exception'
> > endfunc
>
> > func! Foo()
> >    try
> >        silent s:foo()
>
> do you mean:
>     :silent call s:foo()
>
> >    catch
> >        " nop.
> >    endtry
> > endfunc
> > ----- code -----
>
> > ":call Foo()" makes Vim stay 'silent mode'
>
> > After this, :some_command can work fine, but nothing shown in command-line
> > as typing.
> > This bug occurs in this version:
> >http://sourceforge.net/projects/cream/files/Vim/7.2.259/gvim-7-2-259....

Bram Moolenaar

unread,
Sep 30, 2009, 7:24:31 AM9/30/09
to dr-dr xp, vim...@googlegroups.com

> http://sourceforge.net/projects/cream/files/Vim/7.2.259/gvim-7-2-259.exe/do=
> wnload

I see the problem. This actually happens because the "call" is missing
and "s:foo()" is a substitute command, just like "s/foo()//".

When changing it to this:

func! s:foo()
throw 'exception'
endfunc

func! Foo()
try
silent s:foo()
catch

unsilent echo "EX: " . v:exception
endtry
endfunc

You can see the error message:
EX: Vim(substitute):E486: Pattern not found: foo()

But when the cursor is on the line with "silent" there is no error and
the bug isn't trigerred.

I'll fix it.

--
He was not in the least bit scared to be mashed into a pulp
Or to have his eyes gouged out and his elbows broken;
To have his kneecaps split and his body burned away
And his limbs all hacked and mangled, brave Sir Robin.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@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 ///

Andy Wokula

unread,
Sep 30, 2009, 8:20:43 AM9/30/09
to vim...@googlegroups.com
Bram Moolenaar schrieb:

>
> Someone with the weird name dr-dr xp wrote:
>
>> ----- code -----
>> func! s:foo()
>> throw 'exception'
>> endfunc
>>
>> func! Foo()
>> try
>> silent s:foo()
>> catch
>> " nop.
>> endtry
>> endfunc
>> ----- code -----
>>
>> ":call Foo()" makes Vim stay 'silent mode'
>>
>> After this, :some_command can work fine, but nothing shown in
>> command-line as typing.
>> This bug occurs in this version:
>> http://sourceforge.net/projects/cream/files/Vim/7.2.259/gvim-7-2-259.exe/download

> I see the problem. This actually happens because the "call" is
> missing and "s:foo()" is a substitute command, just like "s/foo()//".
>
> When changing it to this:
>
> func! s:foo()
> throw 'exception'
> endfunc
>
> func! Foo()
> try
> silent s:foo()
> catch
> unsilent echo "EX: " . v:exception
> endtry
> endfunc
>
> You can see the error message:
> EX: Vim(substitute):E486: Pattern not found: foo()
>
> But when the cursor is on the line with "silent" there is no error and

... because the :substitute succeeds (to explain it to myself and a few
others).

> the bug isn't trigerred.

Which bug? Do you want to disallow this valid :subst-syntax?

> I'll fix it.

You want to disallow the ":"-char for separating :subst arguments? Ok.

Worse: Require at least two :subst-separator chars.

--
Andy

Lech Lorens

unread,
Sep 30, 2009, 8:39:23 AM9/30/09
to vim...@googlegroups.com
2009/9/30 Andy Wokula <anw...@yahoo.de>:
>
> Bram Moolenaar schrieb:
[...]

>> But when the cursor is on the line with "silent" there is no error and
>
> ... because the :substitute succeeds (to explain it to myself and a few
> others).
>
>> the bug isn't trigerred.
>
> Which bug?  Do you want to disallow this valid :subst-syntax?

Instead of giving arguments against the fix you might want to try to
reproduce the problem. Like dr-dr xp explained, the problem is that
after the exception is thrown, whatever you type in the command line
is not displayed.

--
Kind regards,
Lech Lorens

Andy Wokula

unread,
Sep 30, 2009, 9:33:13 AM9/30/09
to vim...@googlegroups.com
Lech Lorens schrieb:

I was just curious and took the risk of giving a dumb argument, hoping
somebody like you will point me to the right direction ...

Think I got it: The "bug" was introduced with a later patch (maybe the
patch adding the :unsilent command) and I forgot that I can't reproduce
it with my older version.

--
Andy

Reply all
Reply to author
Forward
0 new messages