Hi Enno,

2015/2/5(Thu) 18:25:49 UTC+9 Enno:
> Le jeudi 5 février 2015 05:12:19 UTC+1, h_east a écrit :
> > Hi Enno,
> > 
> > 2015/2/4(Wed) 20:42:57 UTC+9 Enno:
> > > How about
> > > 
> > > let b:isLoc = len(getloclist(0)) > 0 ? 1 : 0
> > > 
> > > inside of a qf filetype window. See :h getloclist() that explains
> > > 
> > > For a location list window, the displayed location list is returned. 
> > > 
> > > All credit to romainl at 
> > > https://github.com/romainl/dotvim/blob/44e87b3fbb829145a23bd5b2be1807cc958308e5/bundle/qf/after/ftplugin/qf.vim
> > 
> > A location list can be associated with a quickfix window.
> > In this case, it can not be determined correctly in this work-around.
> > 
> > Try this:
> > - move Vim source-code directory.
> >   $ cd vim/src
> > - run vim (no vimrc, no plugin)
> >   $ vim -N -u NONE screen.c
> > 
> > :vimgrep screen *.c
> > :copen
> > :echo len(getloclist(0))          " on quickfix window
> > 0                                 " Correct
> > :lvimgrep update_screen *.c
> > :wincmd w
> > :lopen
> > :echo len(getloclist(0))          " on location list window
> > 75                                " Correct
> > :wincmd k
> > :echo len(getloclist(0))          " on quickfix window
> > 75                                " Not correct!
> > 
> > 
> > Our patch always returns correct value.
> > Thanks for the response.
> > 
> > Best regards,
> > Hirohito Higashi (a.k.a h_east)
> 
> Hello Hirohito,
> 
> Yep, this check has several issues. Yours stands, as well as that it fails 
> when the qflist is empty. 
> 
> More stable seems the following workaround attachched below, originally from 
> 
> https://groups.google.com/forum/#!msg/vim_use/sfRlnrOwN2M/JAdzwHe51qYJ
> 
> but at the same time, it shows that this patch is called for.
> 
> --
> 
> In ~/.vim/ftplugin/qf.vim:
> 
> if exists('s:processing')
>   finish
> endif
> let listbufnr = bufnr("%")
> let numwindows = winnr('$')
> let altwin = winnr('#')
> let curwin = winnr()
> let s:processing = 1
> copen
> if curwin == winnr()
>   call setbufvar(listbufnr, 'isQuickfix', '1')
> endif
> " close the quickfix list if it was closed when we began
> if numwindows != winnr('$')
>   cclose
> endif
> " return to quickfix/location list
> exe altwin 'wincmd w'
> exe curwin 'wincmd w'
> unlet s:processing
> 
> Then a buffer of file type qf is a quickfix list if b:isQuickfix exists.

I like simple way. 
I dislike work-around.
I dislike complex way.

Our patch is very simple.
In fact, This patch is only two line. 

>           set_internal_string_var("b:qflisttype", (curwin->w_llist_ref
>                                           == NULL) ? "quickfix" : "location");

What's dislike you this patch?

Let's go the simple way :-)

Best regards,
Hirohito Higashi (a.k.a h_east)

-- 
-- 
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 because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui