Merge remote-tracking branch 'justone/add_one_time_check'

This commit is contained in:
Martin Grenfell 2011-11-28 23:41:53 +00:00
commit e7b8375dec

View File

@ -52,12 +52,13 @@ if !exists("g:syntastic_stl_format")
endif endif
"refresh and redraw all the error info for this buf when saving or reading "refresh and redraw all the error info for this buf when saving or reading
autocmd bufreadpost,bufwritepost * call s:UpdateErrors() command SyntasticCheck call s:UpdateErrors(1)
function! s:UpdateErrors() autocmd bufreadpost,bufwritepost * call s:UpdateErrors(0)
function! s:UpdateErrors(skip_disabled)
if &buftype == 'quickfix' if &buftype == 'quickfix'
return return
endif endif
call s:CacheErrors() call s:CacheErrors(a:skip_disabled)
if g:syntastic_enable_balloons && has('balloon_eval') if g:syntastic_enable_balloons && has('balloon_eval')
let b:syntastic_balloons = {} let b:syntastic_balloons = {}
@ -95,12 +96,12 @@ endfunction
" "
"depends on a function called SyntaxCheckers_{&ft}_GetLocList() existing "depends on a function called SyntaxCheckers_{&ft}_GetLocList() existing
"elsewhere "elsewhere
function! s:CacheErrors() function! s:CacheErrors(skip_disabled)
let b:syntastic_loclist = [] let b:syntastic_loclist = []
if filereadable(expand("%")) if filereadable(expand("%"))
for ft in split(&ft, '\.') for ft in split(&ft, '\.')
if s:Checkable(ft) if s:Checkable(ft, a:skip_disabled)
let b:syntastic_loclist = extend(b:syntastic_loclist, SyntaxCheckers_{ft}_GetLocList()) let b:syntastic_loclist = extend(b:syntastic_loclist, SyntaxCheckers_{ft}_GetLocList())
endif endif
endfor endfor
@ -293,11 +294,15 @@ function! SyntasticMake(options)
return errors return errors
endfunction endfunction
function! s:Checkable(ft) function! s:Checkable(ft, skip_disabled)
if !exists("g:loaded_" . a:ft . "_syntax_checker") if !exists("g:loaded_" . a:ft . "_syntax_checker")
exec "runtime syntax_checkers/" . a:ft . ".vim" exec "runtime syntax_checkers/" . a:ft . ".vim"
endif endif
if a:skip_disabled
return 1
endif
return exists("*SyntaxCheckers_". a:ft ."_GetLocList") && return exists("*SyntaxCheckers_". a:ft ."_GetLocList") &&
\ index(g:syntastic_disabled_filetypes, a:ft) == -1 \ index(g:syntastic_disabled_filetypes, a:ft) == -1
endfunction endfunction
@ -314,7 +319,7 @@ function! s:Disable(...)
endif endif
"will cause existing errors to be cleared "will cause existing errors to be cleared
call s:UpdateErrors() call s:UpdateErrors(0)
endfunction endfunction
"enable syntax checking for the given filetype (defaulting to current ft) "enable syntax checking for the given filetype (defaulting to current ft)
@ -327,7 +332,7 @@ function! s:Enable(...)
endif endif
if !&modified if !&modified
call s:UpdateErrors() call s:UpdateErrors(0)
redraw! redraw!
else else
echom "Syntasic: enabled for the '" . ft . "' filetype. :write out to update errors" echom "Syntasic: enabled for the '" . ft . "' filetype. :write out to update errors"