Yegappan Lakshmanan wrote:

>Hi Charles,
>
>On 9/11/07, Charles E Campbell Jr <[EMAIL PROTECTED]> wrote:
>  
>
>>
>>Well, I was going to suggest
>>
>>:let qlist=[]
>>:bufdo silent vimgrep /pattern/ % | call add(qlist,getqflist())
>>:call setqflist(qlist)
>>:cope
>>
>>Unfortunately, the formats for what getqflist() delivers and setqflist()
>>takes are different, and beating them into compatiblity is more than I
>>want to attempt at the moment.
>>
>>    
>>
>
>This does work. You have to use extend() instead of add() in
>the above commands. When you call add(), the current quickfix
>list is added as a single item to qlist.
>
>- Yegappan
>  
>
Thanks, Yegappan!

Guess I didn't look much further as to why the above didn't work when I 
read, under the help for setqflist(), that:
"Note that the list is not exactly the same as what |getqflist()| returns."

So, here's a vim snippet implementing the above:

" qfbp.vim
"   Author: Charles E. Campbell, Jr.
"   Date:   Sep 12, 2007
"   Version: 1
" ---------------------------------------------------------------------
"  Load Once: {{{1
if &cp || exists("g:loaded_qfpat")
 finish
endif
let g:loaded_qfpat= "v1"
let s:keepcpo      = &cpo
set cpo&vim

" ---------------------------------------------------------------------
"  Public Interface: {{{1
com! -nargs=1 QFBP  call s:QuickFixBufPat(<q-args>)

" ---------------------------------------------------------------------
" s:QuickFixBufPat: {{{2
fun! s:QuickFixBufPat(pat)
"  call Dfunc("s:QuickFixBufPat(pat<".a:pat.">)")
  let qlist=[]
  exe "bufdo silent vimgrep /".a:pat."/ % | call extend(qlist,getqflist())"
  call setqflist(qlist)
  cope
"  call Dret("s:QuickFixBufPat")
endfun

" ---------------------------------------------------------------------
"  Restore: {{{1
let &cpo= s:keepcpo
unlet s:keepcpo
" vim: ts=4 fdm=marker


Regards,
Chip Campbell


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui