From 49a94fe69f255a493f65e7dc03ba17f14c50a19a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 2 Jul 2017 18:37:17 +0300 Subject: [PATCH] Bug fix: add support for Vim 7.1.261 and earlier. --- autoload/syntastic/util.vim | 23 +++++++++++++++-------- plugin/syntastic.vim | 2 +- syntax_checkers/lisp/clisp.vim | 6 +++--- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 6ead9ea2..10d6268d 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -76,7 +76,7 @@ function! syntastic#util#tmpdir() abort " {{{2 if (has('unix') || has('mac')) && executable('mktemp') && !has('win32unix') " TODO: option "-t" to mktemp(1) is not portable let tmp = $TMPDIR !=# '' ? $TMPDIR : $TMP !=# '' ? $TMP : '/tmp' - let out = split(syntastic#util#system('mktemp -q -d ' . tmp . '/vim-syntastic-' . getpid() . '-XXXXXXXX'), "\n") + let out = split(syntastic#util#system('mktemp -q -d ' . tmp . '/vim-syntastic-' . s:fuzz() . '-XXXXXXXX'), "\n") if v:shell_error == 0 && len(out) == 1 let tempdir = out[0] endif @@ -84,13 +84,13 @@ function! syntastic#util#tmpdir() abort " {{{2 if tempdir ==# '' if has('win32') || has('win64') - let tempdir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-' . getpid() + let tempdir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-' . s:fuzz() elseif has('win32unix') - let tempdir = syntastic#util#CygwinPath('/tmp/vim-syntastic-' . getpid()) + let tempdir = syntastic#util#CygwinPath('/tmp/vim-syntastic-' . s:fuzz()) elseif $TMPDIR !=# '' - let tempdir = $TMPDIR . '/vim-syntastic-' . getpid() + let tempdir = $TMPDIR . '/vim-syntastic-' . s:fuzz() else - let tempdir = '/tmp/vim-syntastic-' . getpid() + let tempdir = '/tmp/vim-syntastic-' . s:fuzz() endif try @@ -401,9 +401,6 @@ function! syntastic#util#setLastTick(buf) abort " {{{2 call setbufvar(a:buf, 'syntastic_lasttick', getbufvar(a:buf, 'changedtick')) endfunction " }}}2 -let s:_wid_base = 'syntastic_' . getpid() . '_' . reltimestr(g:_SYNTASTIC_START) . '_' -let s:_wid_pool = 0 - " Add unique IDs to windows function! syntastic#util#setWids() abort " {{{2 for tab in range(1, tabpagenr('$')) @@ -614,8 +611,18 @@ endfunction "}}}2 let s:_getbufvar = function(v:version > 703 || (v:version == 703 && has('patch831')) ? 'getbufvar' : 's:_getbufvar_dumb') lockvar s:_getbufvar +function! s:_fuzz_dumb() abort " {{{2 + return 'tmp' +endfunction " }}}2 + +let s:_fuzz = function(exists('*getpid') ? 'getpid' : 's:_fuzz_dumb') +lockvar s:_fuzz + " }}}1 +let s:_wid_base = 'syntastic_' . s:_fuzz() . '_' . reltimestr(g:_SYNTASTIC_START) . '_' +let s:_wid_pool = 0 + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index cf32d937..67dc0d93 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.8.0-59' +let g:_SYNTASTIC_VERSION = '3.8.0-60' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 diff --git a/syntax_checkers/lisp/clisp.vim b/syntax_checkers/lisp/clisp.vim index 26de435e..ea8251a8 100644 --- a/syntax_checkers/lisp/clisp.vim +++ b/syntax_checkers/lisp/clisp.vim @@ -19,13 +19,13 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_lisp_clisp_GetLocList() dict + let buf = bufnr('') let tmpdir = syntastic#util#tmpdir() - let out = tmpdir !=# '.' ? ('-o ' . syntastic#util#shescape(tmpdir . syntastic#util#Slash() . 'syntastic_' . getpid())) : '' let makeprg = self.makeprgBuild({ \ 'args_after': '-q', \ 'fname_before': '-c', - \ 'post_args_after': out }) + \ 'post_args_after': ['-o', tmpdir] }) let errorformat = \ '%-G;%.%#,' . @@ -40,7 +40,7 @@ function! SyntaxCheckers_lisp_clisp_GetLocList() dict let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr('')} }) + \ 'defaults': {'bufnr': buf} }) call syntastic#util#rmrf(tmpdir)