[Vim-latex-cvs] vimfiles/ftplugin/latex-suite compiler.vim,1.57,1.58
Brought to you by:
srinathava,
tmaas
|
From: <sri...@us...> - 2003-12-14 09:18:03
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1:/tmp/cvs-serv8076
Modified Files:
compiler.vim
Log Message:
Attempting to fix the filenames with spaces problem. Also since
Tex_GetMainFileName() _always_ returns a file name now, (even if a
.latexmain file does not exist), lots of redundant logic is now removed.
Index: compiler.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/compiler.vim,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** compiler.vim 2 Dec 2003 11:38:19 -0000 1.57
--- compiler.vim 14 Dec 2003 07:17:16 -0000 1.58
***************
*** 97,116 ****
pclose!
! " Logic to choose how to compile:
! " if b:fragmentFile exists, then this is a fragment
! " therefore, just compile this file
! " else
! " if makefile or Makefile exists, then use that
! " elseif *.latexmain exists
! " use that
! " else use current file
! "
! " if mainfname exists, then it means it was supplied to Tex_RunLaTeX().
! " Extract the complete file name including the extension.
! let mainfname = Tex_GetMainFileName(':r')
call Tex_Debug('Tex_CompileLatex: getting mainfname = ['.mainfname.'] from Tex_GetMainFileName', 'comp')
- if exists('b:fragmentFile') || mainfname == ''
- let mainfname = escape(expand('%:t'), ' ')
- endif
" if a makefile exists and the user wants to use it, then use that
--- 97,117 ----
pclose!
! let curd = getcwd()
!
! " Find the main file corresponding to this file. Always cd to the
! " directory containing the file to avoid problems with the directory
! " containing spaces.
! " Latex on linux seems to be unable to handle file names with spaces at
! " all! Therefore for the moment, do not attempt to handle spaces in the
! " file name.
! if exists('b:fragmentFile')
! let mainfname = expand('%:p:t')
! call Tex_CD(expand('%:p:h')
! else
! let mainfname = Tex_GetMainFileName(':p:t')
! call Tex_CD(Tex_GetMainFileName(':p:h'))
! end
!
call Tex_Debug('Tex_CompileLatex: getting mainfname = ['.mainfname.'] from Tex_GetMainFileName', 'comp')
" if a makefile exists and the user wants to use it, then use that
***************
*** 139,150 ****
endif
redraw!
endfunction " }}}
" Tex_SetupErrorWindow: sets up the cwindow and preview of the .log file {{{
" Description:
function! Tex_SetupErrorWindow()
! let mainfname = Tex_GetMainFileName(':r')
! if exists('b:fragmentFile') || mainfname == ''
! let mainfname = expand('%:t')
! endif
let winnum = winnr()
--- 140,150 ----
endif
redraw!
+
+ call Tex_CD(curd)
endfunction " }}}
" Tex_SetupErrorWindow: sets up the cwindow and preview of the .log file {{{
" Description:
function! Tex_SetupErrorWindow()
! let mainfname = Tex_GetMainFileName()
let winnum = winnr()
***************
*** 194,198 ****
let dir = expand("%:p:h").'/'
let curd = getcwd()
! exec 'cd '.expand("%:p:h")
" first get the dependency chain of this format.
--- 194,198 ----
let dir = expand("%:p:h").'/'
let curd = getcwd()
! call Tex_CD(expand("%:p:h"))
" first get the dependency chain of this format.
***************
*** 216,221 ****
--- 216,223 ----
if g:Tex_MultipleCompileFormats =~ '\<'.s:target.'\>'
+ call Tex_Debug("compiling file multiple times via Tex_CompileMultipleTimes", "comp")
call Tex_CompileMultipleTimes()
else
+ call Tex_Debug("compiling file once via Tex_CompileLatex", "comp")
call Tex_CompileLatex()
endif
***************
*** 233,237 ****
call Tex_SetupErrorWindow()
! exec 'cd '.curd
endfunction
--- 235,239 ----
call Tex_SetupErrorWindow()
! call Tex_CD(curd)
endfunction
***************
*** 250,264 ****
end
- let dir = expand("%:p:h").'/'
let curd = getcwd()
- exec 'cd '.expand("%:p:h")
" If b:fragmentFile is set, it means this file was compiled as a fragment
" using Tex_PartCompile, which means that we want to ignore any
" *.latexmain or makefile's.
! if Tex_GetMainFileName() != '' && !exists('b:fragmentFile')
! let mainfname = Tex_GetMainFileName()
else
let mainfname = expand("%:p:t:r")
endif
--- 252,268 ----
end
let curd = getcwd()
" If b:fragmentFile is set, it means this file was compiled as a fragment
" using Tex_PartCompile, which means that we want to ignore any
" *.latexmain or makefile's.
! if !exists('b:fragmentFile')
! " cd to the location of the file to avoid having to deal with spaces
! " in the directory name.
! let mainfname = Tex_GetMainFileName(':p:t:r')
! call Tex_CD(Tex_GetMainFileName(':p:h'))
else
let mainfname = expand("%:p:t:r")
+ call Tex_CD(expand("%:p:h"))
endif
***************
*** 306,310 ****
endif
! exec 'cd '.curd
endfunction
--- 310,314 ----
endif
! call Tex_CD(curd)
endfunction
***************
*** 336,348 ****
let viewer = g:Tex_ViewRule_dvi
- let dir = expand("%:p:h").'/'
let curd = getcwd()
- exec 'cd '.expand("%:p:h")
! if Tex_GetMainFileName() != ''
! let mainfname = Tex_GetMainFileName()
! else
! let mainfname = expand("%:p:t:r")
! endif
" inverse search tips taken from Dimitri Antoniou's tip and Benji Fisher's
--- 340,350 ----
let viewer = g:Tex_ViewRule_dvi
let curd = getcwd()
! let mainfname = Tex_GetMainFileName(':t')
! let mainfnameRoot = fnamemodify(Tex_GetMainFileName(), ':t:r')
! " cd to the location of the file to avoid problems with directory name
! " containing spaces.
! call Tex_CD(Tex_GetMainFileName(':p:h'))
" inverse search tips taken from Dimitri Antoniou's tip and Benji Fisher's
***************
*** 350,354 ****
if has('win32')
! let execString = 'silent! !start '. viewer.' -s '.line('.').expand('%:p:t').' '.mainfname
else
--- 352,356 ----
if has('win32')
! let execString = 'silent! !start '. viewer.' -s '.line('.').expand('%:p:t').' '.mainfnameRoot
else
***************
*** 358,364 ****
\ (viewer == "xdvi" || viewer == "xdvik")
! let execString = '!'.viewer.' -name xdvi -sourceposition '.line('.').expand('%').
\ ' -editor "gvim --servername '.v:servername.' --remote-silent +\%l \%f" '.
! \ mainfname.'.dvi &'
elseif exists('g:Tex_UseEditorSettingInDVIViewer') &&
--- 360,366 ----
\ (viewer == "xdvi" || viewer == "xdvik")
! let execString = '!'.viewer.' -name xdvi -sourceposition '.line('.').mainfname.
\ ' -editor "gvim --servername '.v:servername.' --remote-silent +\%l \%f" '.
! \ mainfnameRoot.'.dvi &'
elseif exists('g:Tex_UseEditorSettingInDVIViewer') &&
***************
*** 366,374 ****
\ viewer == "kdvi"
! let execString = 'silent! !kdvi --unique file:'.mainfname.'.dvi\#src:'.line('.').Tex_GetMainFileName(":p:t:r").' &'
else
! let execString = 'silent! !'.viewer.' -name xdvi -sourceposition '.line('.').expand('%').' '.mainfname.'.dvi &'
endif
--- 368,376 ----
\ viewer == "kdvi"
! let execString = 'silent! !kdvi --unique file:'.mainfnameRoot.'.dvi\#src:'.line('.').mainfname.' &'
else
! let execString = 'silent! !'.viewer.' -name xdvi -sourceposition '.line('.').mainfname.' '.mainfnameRoot.'.dvi &'
endif
***************
*** 381,385 ****
endif
! exec 'cd '.curd
endfunction
--- 383,387 ----
endif
! call Tex_CD(curd)
endfunction
***************
*** 425,435 ****
" otherwise do it from current file
let mainfile = Tex_GetMainFileName(":p:r")
! if mainfile != ''
! exe 'bot 1 split '.mainfile
! exe '1,/\s*\\begin{document}/w '.tmpfile
! wincmd q
! else
! exe '1,/\s*\\begin{document}/w '.tmpfile
! endif
exe a:firstline.','.a:lastline."w! >> ".tmpfile
--- 427,433 ----
" otherwise do it from current file
let mainfile = Tex_GetMainFileName(":p:r")
! exe 'bot 1 split '.escape(mainfile, ' ')
! exe '1,/\s*\\begin{document}/w '.tmpfile
! wincmd q
exe a:firstline.','.a:lastline."w! >> ".tmpfile
***************
*** 471,479 ****
" Description: compiles a file multiple times to get cross-references right.
function! Tex_CompileMultipleTimes()
! let mainFileName_root = Tex_GetMainFileName(':p:t:r:r')
!
! if mainFileName_root == ''
! let mainFileName_root = expand("%:p:t:r")
! endif
" First ignore undefined references and the
--- 469,477 ----
" Description: compiles a file multiple times to get cross-references right.
function! Tex_CompileMultipleTimes()
! " Just extract the root without any extension because we want to construct
! " the log file names etc from it.
! let curd = getcwd()
! let mainFileName_root = Tex_GetMainFileName(':p:t:r')
! call Tex_CD(Tex_GetMainFileName(':p:h'))
" First ignore undefined references and the
***************
*** 500,503 ****
--- 498,502 ----
" first run latex.
echomsg "latex run number : ".(runCount+1)
+ call Tex_Debug("Tex_CompileMultipleTimes: latex run number : ".(runCount+1), "comp")
silent! call Tex_CompileLatex()
***************
*** 506,510 ****
" away after compiling again or after bibtex is run etc.
let errlist = Tex_GetErrorList()
! call Tex_Debug("errors = [".errlist."]", "err")
if errlist =~ '\d\+\s\f\+:\d\+\serror'
--- 505,509 ----
" away after compiling again or after bibtex is run etc.
let errlist = Tex_GetErrorList()
! call Tex_Debug("errors = [".errlist."]", "comp")
if errlist =~ '\d\+\s\f\+:\d\+\serror'
***************
*** 567,570 ****
--- 566,571 ----
" emptied because of bibtex/makeindex being run as the last step.
exec 'silent! cfile '.mainFileName_root.'.log'
+
+ call Tex_CD(curd)
endfunction " }}}
***************
*** 764,768 ****
augroup LatexSuite
au LatexSuite User LatexSuiteFileType
! \ call Tex_Debug('compiler.vim: Catching LatexSuiteFileType event') |
\ call <SID>SetCompilerMaps()
augroup END
--- 765,769 ----
augroup LatexSuite
au LatexSuite User LatexSuiteFileType
! \ call Tex_Debug('compiler.vim: Catching LatexSuiteFileType event', 'comp') |
\ call <SID>SetCompilerMaps()
augroup END
|