Revert "add Lclose() and use it when closing the loc list"

This reverts commit e90aa61ca6.

The idea here was to only close the location list window if it could be
verified that it contained only syntastic data. This was done by
comparing the current location list with b:syntastic_loclist to see if
they are the same.

The problem is that, after we recheck errors, b:syntastic_loclist is
empty (if the user has fixed everything) so it doesnt match
getloclist(0) so we cant close it automatically.

Revert this for now and worry about the issue later - if a user
complains or if a new plugin that uses location lists comes up.

Conflicts:

	plugin/syntastic.vim
This commit is contained in:
Martin Grenfell 2011-12-17 19:08:07 +00:00
parent aeca4bfc40
commit 7c623b7278

View File

@ -91,7 +91,7 @@ augroup syntastic
autocmd BufReadPost,BufWritePost * call s:UpdateErrors(1) autocmd BufReadPost,BufWritePost * call s:UpdateErrors(1)
autocmd BufWinEnter * if empty(&bt) | call s:AutoToggleLocList() | endif autocmd BufWinEnter * if empty(&bt) | call s:AutoToggleLocList() | endif
autocmd BufWinLeave * if empty(&bt) | call s:Lclose() | endif autocmd BufWinLeave * if empty(&bt) | lclose | endif
augroup END augroup END
@ -123,41 +123,18 @@ function s:AutoToggleLocList()
silent! ll silent! ll
endif endif
elseif g:syntastic_auto_loc_list == 2 elseif g:syntastic_auto_loc_list == 2
call s:Lclose() lclose
endif endif
if g:syntastic_auto_loc_list == 1 if g:syntastic_auto_loc_list == 1
if s:BufHasErrorsOrWarningsToDisplay() if s:BufHasErrorsOrWarningsToDisplay()
call s:ShowLocList() call s:ShowLocList()
else else
call s:Lclose() "TODO: this will close the loc list window if one was opened by
endif "something other than syntastic
endif
endfunction
"close the current loc list if it contains only syntastic data
"
"Note that we cant just compare the 2 lists since calling setloclist() adds
"some extra default data to the loclist
function! s:Lclose()
if empty(s:LocList())
return
endif
let llist = getloclist(0)
if len(llist) != len(s:LocList())
return
endif
"make sure the line number and message is the same for all elements"
for i in range(0,len(llist)-1)
if llist[i]['lnum'] != s:LocList()[i]['lnum'] || llist[i]['text'] != s:LocList()[i]['text']
return
endif
endfor
lclose lclose
endif
endif
endfunction endfunction
"lazy init the loc list for the current buffer "lazy init the loc list for the current buffer