> From: "Gary Johnson" <[email protected]>
> To: "vim dev" <[email protected]>
> Sent: Tuesday, June 29, 2010 5:40:39 PM
> Subject: Bug in Vim 7.2.438: try, catch and cscope

> After a recent update, I started noticing erroneous behavior in a
> number of my cscope mappings. After some experimenting I discovered
> that Vim is failing to execute a "cs find" command when it follows a
> "cs add" command in a catch block. This has worked fine for a long
> time and through Vim 7.2.148 but stopped working at or before Vim
> 7.2.438.
> 
> I boiled my configuration and functions down to the following
> plugin.
> 
> ------------------------ cscope.vim ------------------------
> set laststatus=2
> set cmdheight=10
> 
> set csverb
> set csqf=s-
> 
> function! Csfind()
> try let x = y
> catch /.*/
> echo v:exception
> cs add cscope.out
> cs find s mch_early_init
> echo "Here"
> endtry endfunction
> ------------------------------------------------------------
> 

I wager I altered this when I submitted 7.2.433, adding CScope 
QuickFixCmd{Pre,Post} autocmd event similar to what already exists
for make, grep, etc. If you try to say a :vimgrep in your catch block,
that goes no where too, right?

A few potential fixes come to mind:
- If you're not explicity needing it, remove the query type from 'csfs'
in the catch block.
- Do the 'cs find' bit outside of the catch block.
- Revert 433. I had been carrying it around as a private patch for a 
couple of years and find it to very useful.


> The first settings just make the command/status area large enough to
> display a number of messages without overwriting or stopping.
> 
> The "let x = y" was a randomly-chosen command that would generate an
> error. The 'echo "Here"' was included to demonstrate that execution
> continued beyond the "cs find" command.
> 
> To demonstrate the behavior, I cd'd to my vim72/src directory (so
> that others could use the same data) in which I had built a cscope
> database. Then I executed
> 
> vim -X -N -u NONE --cmd 'runtime plugin/cscope.vim' -c 'call Csfind()'
> 
> Using Vim 7.2.148 this works correctly: Vim opens a buffer
> containing main.c with the cursor on line 181 and the following text
> on the status lines:
> 
> Vim(let):E121: Undefined variable: y
> (1 of 6): <<global>> mch_early_init();
> Here
> 
> Using Vim 7.2.438, however, this fails: Vim opens an empty buffer
> and displays this on the status lines:
> 
> Vim(let):E121: Undefined variable: y
> Added cscope database cscope.out
> Here
> 
> A "cs find s mch_early_init" command will work if executed now,
> but I need it to work immediately after the "cs add cscope.out"
> command, as it used to.
> 
> With my normal ~/.vimrc, the first set of messages includes the
> "Added cscope database cscope.out" line just before the "(1 of 6)"
> line. I don't know why it didn't appear in this example, but I
> didn't think that detail was all that important.
> 
> Regards,
> Gary
> 
> -- 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 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

Raspunde prin e-mail lui