From 7c623b7278c885a0c9b7c9fec4376a8cf40f50c3 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sat, 17 Dec 2011 19:08:07 +0000 Subject: [PATCH] Revert "add Lclose() and use it when closing the loc list" This reverts commit e90aa61ca65e582c921c468f829a9f9d6fef05c0. 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 --- plugin/syntastic.vim | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index fbe8b431..3d0aac2a 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -91,7 +91,7 @@ augroup syntastic autocmd BufReadPost,BufWritePost * call s:UpdateErrors(1) 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 @@ -123,43 +123,20 @@ function s:AutoToggleLocList() silent! ll endif elseif g:syntastic_auto_loc_list == 2 - call s:Lclose() + lclose endif if g:syntastic_auto_loc_list == 1 if s:BufHasErrorsOrWarningsToDisplay() call s:ShowLocList() else - call s:Lclose() + "TODO: this will close the loc list window if one was opened by + "something other than syntastic + lclose endif 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 -endfunction - "lazy init the loc list for the current buffer function! s:LocList() if !exists("b:syntastic_loclist")