From f527cb1a2d768cb48464048724172160c72f6a51 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 29 Aug 2016 08:11:59 +0300 Subject: [PATCH] Core: fix check_on_open when starting with multiple files. --- plugin/syntastic.vim | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index d7ce2ffe..92e60e2b 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.7.0-201' +let g:_SYNTASTIC_VERSION = '3.7.0-202' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 @@ -244,6 +244,7 @@ endfunction " }}}2 augroup syntastic autocmd! + autocmd VimEnter * call s:VimEnterHook() autocmd BufEnter * call s:BufEnterHook(expand('', 1)) augroup END @@ -268,7 +269,7 @@ endif function! s:BufReadPostHook(fname) abort " {{{2 let buf = syntastic#util#fname2buf(a:fname) - if g:syntastic_check_on_open + if g:syntastic_check_on_open && buf > 0 call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, \ 'autocmd: BufReadPost, buffer ' . buf . ' = ' . string(a:fname)) if index(s:_check_stack, buf) == -1 @@ -288,11 +289,13 @@ function! s:BufEnterHook(fname) abort " {{{2 let buf = syntastic#util#fname2buf(a:fname) call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, \ 'autocmd: BufEnter, buffer ' . buf . ' = ' . string(a:fname) . ', &buftype = ' . string(&buftype)) - if &buftype ==# '' + if buf > 0 && getbufvar(buf, '&buftype') ==# '' let idx = index(reverse(copy(s:_check_stack)), buf) if idx >= 0 - call remove(s:_check_stack, -idx - 1) - call s:UpdateErrors(buf, 1, []) + if !has('vim_starting') + call remove(s:_check_stack, -idx - 1) + call s:UpdateErrors(buf, 1, []) + endif else call s:notifiers.refresh(g:SyntasticLoclist.current()) endif @@ -309,6 +312,17 @@ function! s:BufEnterHook(fname) abort " {{{2 endif endfunction " }}}2 +function! s:VimEnterHook() abort " {{{2 + let buf = bufnr('') + call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, + \ 'autocmd: VimEnter, buffer ' . buf . ' = ' . string(bufname(buf)) . ', &buftype = ' . string(&buftype)) + let idx = index(reverse(copy(s:_check_stack)), buf) + if idx >= 0 && getbufvar(buf, '&buftype') ==# '' + call remove(s:_check_stack, -idx - 1) + call s:UpdateErrors(buf, 1, []) + endif +endfunction " }}}2 + function! s:QuitPreHook(fname) abort " {{{2 let buf = syntastic#util#fname2buf(a:fname) call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS, 'autocmd: QuitPre, buffer ' . buf . ' = ' . string(a:fname))