Handle redefinition of exec after the checker has run.

This commit is contained in:
LCD 47 2015-02-19 11:43:35 +02:00
parent 4782184020
commit 776d4175cd
2 changed files with 22 additions and 7 deletions

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.6.0-27'
let g:_SYNTASTIC_VERSION = '3.6.0-28'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1
@ -486,8 +486,8 @@ function! SyntasticMake(options) " {{{2
if has_key(a:options, 'env') && len(a:options['env'])
for key in keys(a:options['env'])
if key =~? '\m^[a-z_]\+$'
exec 'let env_save[' . string(key) . '] = $' . key
exec 'let $' . key . ' = ' . string(a:options['env'][key])
execute 'let env_save[' . string(key) . '] = $' . key
execute 'let $' . key . ' = ' . string(a:options['env'][key])
endif
endfor
endif
@ -502,7 +502,7 @@ function! SyntasticMake(options) " {{{2
let $LC_MESSAGES = old_lc_messages
if len(env_save)
for key in keys(env_save)
exec 'let $' . key . ' = ' . string(env_save[key])
execute 'let $' . key . ' = ' . string(env_save[key])
endfor
endif
" }}}3

View File

@ -49,9 +49,8 @@ function! g:SyntasticChecker.getName() " {{{2
endfunction " }}}2
function! g:SyntasticChecker.getExec() " {{{2
return
\ expand( exists('b:syntastic_' . self._name . '_exec') ? b:syntastic_{self._name}_exec :
\ syntastic#util#var(self._filetype . '_' . self._name . '_exec', self._exec), 1 )
call self._syncExec()
return self._exec
endfunction " }}}2
function! g:SyntasticChecker.getExecEscaped() " {{{2
@ -121,6 +120,7 @@ function! g:SyntasticChecker.makeprgBuild(opts) " {{{2
endfunction " }}}2
function! g:SyntasticChecker.isAvailable() " {{{2
call self._syncExec()
if !has_key(self, '_available')
let self._available = self._isAvailableFunc()
endif
@ -143,6 +143,21 @@ endfunction " }}}2
" Private methods {{{1
" Synchronise _exec with user's setting. Force re-validation if needed.
function! g:SyntasticChecker._syncExec() dict " {{{2
let user_exec =
\ expand( exists('b:syntastic_' . self._name . '_exec') ? b:syntastic_{self._name}_exec :
\ syntastic#util#var(self._filetype . '_' . self._name . '_exec'), 1 )
if user_exec != '' && user_exec !=# self._exec
let self._exec = user_exec
if has_key(self, '_available')
" we have a new _exec on the block, it has to be validated
call remove(self, '_available')
endif
endif
endfunction " }}}2
function! g:SyntasticChecker._quietMessages(errors) " {{{2
" wildcard quiet_messages
let quiet_filters = copy(syntastic#util#var('quiet_messages', {}))