> From: "Gary Johnson" <[email protected]>
> To: "vim dev" <[email protected]>
> Sent: Thursday, July 1, 2010 2:04:42 AM
> Subject: Re: Bug in Vim 7.2.438: try, catch and cscope
> On 2010-07-01, Bryan Venteicher wrote:
> > > From: "Gary Johnson"
> > > To: "vim dev"
> > > 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.
>
> I didn't understand that. What is 'csfs' and what is removing the
> query type?
Fat fingers: 'csqf'. Query type would be 's' in your example (:cs find
{querytype} {name})
Of course, if it is in there in the first place because you want to use the
quickfix
window for the results of the find in the catch, this really isn't helpful.
>
> > - Do the 'cs find' bit outside of the catch block.
>
> One of the ideas behind the actual plugin is to add the cscope
> database without the user having to think about it, but only when
> it's needed. The Csfind() function tries to execute a "cs find"
> command. If that fails because there are no cscope connections, the
> plugin tries to execute "cs add". If that succeeds, another "cs
> find" is attempted.
>
> The result is that the Csfind() function behaves like "cs find", but
> automatically adds the proper cscope connection the first time it is
> called.
>
> Therefore, the "cs find" bit logically belongs in the catch block.
> It might be possible to set a flag in the catch block and test it
> later outside the catch block to conditionally execute the "cs
> find" bit, but I'd rather avoid such a kludge if there is another
> way around the bug.
Yes, I would thinking adding some flag to do the cs add/find.
You could also :redir ':cs show' to see if a database is loaded.
>
> > - Revert 433. I had been carrying it around as a private patch for a
> > couple of years and find it to very useful.
>
> I'll try that as soon as I figure out how. I haven't done anything
> fancy with Mercurial yet.
>
> Thanks for the pointer to the likely problematic change set. I was
> not looking forward to performing a binary search of 291 change
> sets.
>
> Are you planning on fixing this?
Off hand, short of backing it out, I don't see a way to fix it, although
it has been awhile since I poked around the Vim source. It makes Cscope
behave more like make, grep, etc, which to me, is the a good thing.
>
> 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