Fixed #600: Let not_readable be common

This commit is contained in:
Karl Yngve Lervåg 2016-10-25 07:56:24 +02:00
parent 04f3c9b272
commit 36d50e7ac4
3 changed files with 13 additions and 14 deletions

View File

@ -26,6 +26,16 @@ function! vimtex#view#common#use_temp_files_p(viewer) " {{{1
return a:viewer
endfunction
" }}}1
function! vimtex#view#common#not_readable(output) " {{{1
if !filereadable(a:output)
call vimtex#echo#warning('viewer can not read PDF file!')
return 1
else
return 0
endif
endfunction
" }}}1
let s:xwin_template = {}

View File

@ -52,13 +52,13 @@ function! s:general.view(file) dict " {{{1
" Only copy files if they don't exist
if g:vimtex_view_use_temp_files
\ && s:output_not_readable(outfile)
\ && vimtex#view#common#not_readable(outfile)
call self.copy_files()
endif
else
let outfile = a:file
endif
if s:output_not_readable(outfile) | return | endif
if vimtex#view#common#not_readable(outfile) | return | endif
" Parse options
let opts = g:vimtex_view_general_options
@ -96,15 +96,4 @@ endfunction
" }}}1
function! s:output_not_readable(output) " {{{1
if !filereadable(a:output)
call vimtex#echo#warning('viewer can not read PDF file!')
return 1
else
return 0
endif
endfunction
" }}}1
" vim: fdm=marker sw=2

View File

@ -83,7 +83,7 @@ function! s:mupdf.reverse_search() dict " {{{1
if !executable('synctex') | return | endif
let outfile = b:vimtex.out()
if s:output_not_readable(outfile) | return | endif
if vimtex#view#common#not_readable(outfile) | return | endif
if !self.xwin_exists()
call vimtex#echo#warning('reverse search failed (is MuPDF open?)')