diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 9c92e117..fb788a3b 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -64,6 +64,12 @@ if !exists("g:syntastic_full_redraws") let g:syntastic_full_redraws = !( has('gui_running') || has('gui_macvim')) endif +" TODO: not documented +if !exists("g:syntastic_reuse_loc_lists") + " a relevant bug has been fixed in one of the pre-releases of Vim 7.4 + let g:syntastic_reuse_loc_lists = (v:version >= 704) +endif + let s:registry = g:SyntasticRegistry.Instance() let s:notifiers = g:SyntasticNotifiers.Instance() let s:modemap = g:SyntasticModeMap.Instance() @@ -145,8 +151,10 @@ function! s:UpdateErrors(auto_invoked, ...) let loclist = g:SyntasticLoclist.current() + let w:syntastic_loclist_set = 0 if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump call setloclist(0, loclist.filteredRaw()) + let w:syntastic_loclist_set = 1 if run_checks && g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay() silent! lrewind endif @@ -356,7 +364,6 @@ endfunction function! SyntasticMake(options) call syntastic#util#debug('SyntasticMake: called with options: '. string(a:options)) - let old_loclist = getloclist(0) let old_shell = &shell let old_shellredir = &shellredir let old_errorformat = &errorformat @@ -390,13 +397,13 @@ function! SyntasticMake(options) endif lgetexpr err_lines - let errors = getloclist(0) + let errors = copy(getloclist(0)) if has_key(a:options, 'cwd') exec 'lcd ' . fnameescape(old_cwd) endif - call setloclist(0, old_loclist) + silent! lolder let &errorformat = old_errorformat let &shellredir = old_shellredir let &shell=old_shell diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index d5cd6e39..104470dc 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -143,7 +143,12 @@ endfunction "display the cached errors for this buf in the location list function! g:SyntasticLoclist.show() - call setloclist(0, self.filteredRaw()) + if !exists('w:syntastic_loclist_set') + let w:syntastic_loclist_set = 0 + endif + call setloclist(0, self.filteredRaw(), g:syntastic_reuse_loc_lists && w:syntastic_loclist_set ? 'r' : ' ') + let w:syntastic_loclist_set = 1 + if self.hasErrorsOrWarningsToDisplay() let num = winnr() exec "lopen " . g:syntastic_loc_list_height