perl: add -Tc to makeprg if the shebang contains -T
If the shebang contains -T, then the makeprg looks like: perl '/path/to/efm_perl.pl' -c -w '/tmp/foo.pl' -Tc Mods to syntastic#util#ParseMagicNumber * rename it to ParseShebang (since this name seems more common) * return an empty result set rather than 0 so callers dont have to check if empty()
This commit is contained in:
parent
8540748d0c
commit
7353b32d77
@ -23,7 +23,7 @@ endfunction
|
|||||||
"returns
|
"returns
|
||||||
"
|
"
|
||||||
"{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
|
"{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
|
||||||
function! syntastic#util#ParseMagicNumber()
|
function! syntastic#util#ParseShebang()
|
||||||
for lnum in range(1,5)
|
for lnum in range(1,5)
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
|
|
||||||
@ -33,6 +33,8 @@ function! syntastic#util#ParseMagicNumber()
|
|||||||
return {'exe': exe, 'args': args}
|
return {'exe': exe, 'args': args}
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
return {'exe': '', 'args': []}
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
|
@ -40,7 +40,18 @@ function! SyntaxCheckers_perl_GetLocList()
|
|||||||
else
|
else
|
||||||
let makeprg = g:syntastic_perl_efm_program . ' ' . shellescape(expand('%'))
|
let makeprg = g:syntastic_perl_efm_program . ' ' . shellescape(expand('%'))
|
||||||
endif
|
endif
|
||||||
|
let makeprg .= s:ExtraMakeprgArgs()
|
||||||
|
|
||||||
let errorformat = '%t:%f:%l:%m'
|
let errorformat = '%t:%f:%l:%m'
|
||||||
|
|
||||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:ExtraMakeprgArgs()
|
||||||
|
let shebang = syntastic#util#ParseShebang()
|
||||||
|
if index(shebang['args'], '-T') != -1
|
||||||
|
return ' -Tc'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user