Description: Latest upstream changes
Origin: upstream git, diff 8b6228..3592f2
 http://vim-latex.git.sourceforge.net/git/gitweb.cgi?p=vim-latex/vim-latex

--
--- a/ftplugin/latex-suite/compiler.vim
+++ b/ftplugin/latex-suite/compiler.vim
@@ -1,8 +1,8 @@
 "=============================================================================
-" 	     File: compiler.vim
+"        File: compiler.vim
 "      Author: Srinath Avadhanula
 "     Created: Tue Apr 23 05:00 PM 2002 PST
-" 
+"
 "  Description: functions for compiling/viewing/searching latex documents
 "=============================================================================
 
@@ -51,7 +51,7 @@
 					\'for more information',
 					\"&ok", 1, 'Warning')
 			else
-				call input( 
+				call input(
 					\'No '.a:type.' rule defined for target '.target."\n".
 					\'Please specify a rule in $VIMRUNTIME/ftplugin/tex/texrc'."\n".
 					\'     :help Tex_'.a:type.'Rule_format'."\n".
@@ -64,7 +64,7 @@
 		endif
 		exe 'cd '.s:origdir
 	endif
-endfunction 
+endfunction
 
 function! SetTeXTarget(...)
 	if a:0 < 1
@@ -87,7 +87,7 @@
 
 " }}}
 " Tex_CompileLatex: compiles the present file. {{{
-" Description: 
+" Description:
 function! Tex_CompileLatex()
 	if &ft != 'tex'
 		echo "calling Tex_RunLaTeX from a non-tex file"
@@ -150,8 +150,8 @@
 " master tex file. in this case, make a file called mainfile.latexmain in the
 " directory containig the file. in other words, if the current file is
 " ~/thesis/chapter.tex
-" so that doing "latex chapter.tex" doesnt make sense, then make a file called 
-" main.tex.latexmain 
+" so that doing "latex chapter.tex" doesnt make sense, then make a file called
+" main.tex.latexmain
 " in the ~/thesis directory. this will then run "latex main.tex" when
 " Tex_RunLaTeX() is called.
 function! Tex_RunLaTeX()
@@ -204,7 +204,7 @@
 
 		let i = i + 1
 	endwhile
-	
+
 	let s:target = initTarget
 	let s:origwinnum = winnr()
 	call Tex_SetupErrorWindow()
@@ -223,9 +223,9 @@
 		echo "calling Tex_ViewLaTeX from a non-tex file"
 		return
 	end
-	
+
 	let s:origdir = fnameescape(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.
@@ -292,7 +292,7 @@
 		endif
 
 		if( Tex_GetVarValue('Tex_ExecuteUNIXViewerInForeground') != 1 )
-			let execString = execString.' &' 
+			let execString = execString.' &'
 		endif
 
 	end
@@ -313,7 +313,7 @@
 " Tex_ForwardSearchLaTeX: searches for current location in dvi file. {{{
 " Description: if the DVI viewer is compatible, then take the viewer to that
 "              position in the dvi file. see docs for Tex_RunLaTeX() to set a
-"              master file if this is an \input'ed file. 
+"              master file if this is an \input'ed file.
 " Tip: With YAP on Windows, it is possible to do forward and inverse searches
 "      on DVI files. to do forward search, you'll have to compile the file
 "      with the --src-specials option. then set the following as the command
@@ -331,7 +331,7 @@
 		return
 	endif
 	let viewer = Tex_GetVarValue('Tex_ViewRule_'.s:target)
-	
+
 	let s:origdir = fnameescape(getcwd())
 
 	let mainfname = Tex_GetMainFileName(':t')
@@ -340,28 +340,28 @@
 	" 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
 	" tips on vim.sf.net (vim.sf.net tip #225)
-	if (has('win32') && (viewer =~? "^ *yap\( \|$\)"))
+	if (has('win32') && (viewer =~? '^ *yap\( \|$\)'))
 
 		let execString = 'silent! !start '. viewer.' -s '.line('.').expand('%').' '.mainfnameRoot
 
 
-	elseif (has('macunix') && (viewer =~ "^ *\(Skim\|PDFView\|TeXniscope\)\( \|$\)"))
+	elseif (has('macunix') && (viewer =~ '^ *\(Skim\|PDFView\|TeXniscope\)\( \|$\)'))
 		" We're on a Mac using a traditional Mac viewer
 
-		if viewer =~ "^ *Skim"
+		if viewer =~ '^ *Skim'
 
 				let execString = 'silent! !/Applications/Skim.app/Contents/SharedSupport/displayline '.
 					\ line('.').' "'.mainfnameFull.'.'.s:target.'" "'.expand("%:p").'"'
 
-		elseif viewer =~ "^ *PDFView"
+		elseif viewer =~ '^ *PDFView'
 
 				let execString = 'silent! !/Applications/PDFView.app/Contents/MacOS/gotoline.sh '.
 					\ line('.').' "'.mainfnameFull.'.'.s:target.'" "'.expand("%:p").'"'
 
-		elseif viewer =~ "^ *TeXniscope"
+		elseif viewer =~ '^ *TeXniscope'
 
 				let execString = 'silent! !/Applications/TeXniscope.app/Contents/Resources/forward-search.sh '.
 					\ line('.').' "'.expand("%:p").'" "'.mainfnameFull.'.'.s:target.'"'
@@ -382,7 +382,7 @@
 							\ ' -editor "gvim --servername '.v:servername.' --remote-silent +\%l \%f" '.
 							\ mainfnameRoot.'.dvi'
 
-			elseif viewer =~ "^ *kdvi"
+			elseif viewer =~ '^ *kdvi'
 
 				let execString = 'silent! !'.viewer.' --unique file:'.mainfnameRoot.'.dvi\#src:'.line('.').expand("%")
 
@@ -390,10 +390,9 @@
 
 				let execString = 'silent! !'.viewer.' -name xdvi -sourceposition "'.line('.').' '.expand("%").'" '.mainfnameRoot.'.dvi'
 
-			elseif viewer =~ "^ *okular"
-
-				let execString = 'silent! !'.viewer.' '.mainfnameRoot.'.dvi\#src:'.line('.').expand("%")
+			elseif viewer =~ '^ *okular'
 
+				let execString = 'silent! !'.viewer.' --unique '.mainfnameRoot.'.'.s:target.'\#src:'.line('.').expand("%")
 
 			endif
 
@@ -408,7 +407,7 @@
 		" See if we should add &. On Mac (at least in MacVim), it seems
 		" like this should NOT be added...
 		if( Tex_GetVarValue('Tex_ExecuteUNIXViewerInForeground') != 1 )
-			let execString = execString.' &' 
+			let execString = execString.' &'
 		endif
 
 	endif
@@ -425,8 +424,8 @@
 " }}}
 
 " ==============================================================================
-" Functions for compiling parts of a file. 
-" ============================================================================== 
+" Functions for compiling parts of a file.
+" ==============================================================================
 " Tex_PartCompile: compiles selected fragment {{{
 " Description: creates a temporary file from the selected fragment of text
 "       prepending the preamble and \end{document} and then asks Tex_RunLaTeX() to
@@ -473,7 +472,7 @@
 	" append the \end{document} line.
 	$ put ='\end{document}'
 	w
-	
+
 	" set this as a fragment file.
 	let b:fragmentFile = 1
 
@@ -499,7 +498,7 @@
 
 " ==============================================================================
 " Compiling a file multiple times to resolve references/citations etc.
-" ============================================================================== 
+" ==============================================================================
 " Tex_CompileMultipleTimes: The main function {{{
 " Description: compiles a file multiple times to get cross-references right.
 function! Tex_CompileMultipleTimes()
@@ -509,8 +508,8 @@
 	let mainFileName_root = Tex_GetMainFileName(':p:t:r')
 	call Tex_CD(Tex_GetMainFileName(':p:h'))
 
-	" First ignore undefined references and the 
-	" "rerun to get cross-references right" message from 
+	" First ignore undefined references and the
+	" "rerun to get cross-references right" message from
 	" the compiler output.
 	let origlevel = Tex_GetVarValue('Tex_IgnoreLevel')
 	let origpats = Tex_GetVarValue('Tex_IgnoredWarnings')
@@ -534,9 +533,9 @@
 
 		" first run latex.
 		echomsg "latex run number : ".(runCount+1)
-		call Tex_Debug("Tex_CompileMultipleTimes: latex run number : ".(runCount+1), "comp") 
+		call Tex_Debug("Tex_CompileMultipleTimes: latex run number : ".(runCount+1), "comp")
 		silent! call Tex_CompileLatex()
-		
+
 		" If there are errors in any latex compilation step, immediately
 		" return. For now, do not bother with warnings because those might go
 		" away after compiling again or after bibtex is run etc.
@@ -627,14 +626,14 @@
 endfunction " }}}
 
 " ==============================================================================
-" Helper functions for 
+" Helper functions for
 " . viewing the log file in preview mode.
 " . syncing the display between the quickfix window and preview window
 " . going to the correct line _and column_ number from from the quick fix
 "   window.
-" ============================================================================== 
+" ==============================================================================
 " Tex_SetupErrorWindow: sets up the cwindow and preview of the .log file {{{
-" Description: 
+" Description:
 function! Tex_SetupErrorWindow()
 	let mainfname = Tex_GetMainFileName()
 
@@ -664,7 +663,7 @@
 		" resize the window to just fit in with the number of lines.
 		exec ( line('$') < 4 ? line('$') : 4 ).' wincmd _'
         if Tex_GetVarValue('Tex_GotoError') == 1
- 	        call Tex_GotoErrorLocation(mfnlog)
+	        call Tex_GotoErrorLocation(mfnlog)
         else
 			exec s:origwinnum.' wincmd w'
         endif
@@ -672,12 +671,12 @@
 
 endfunction " }}}
 " Tex_PositionPreviewWindow: positions the preview window correctly. {{{
-" Description: 
-" 	The purpose of this function is to count the number of times an error
-" 	occurs on the same line. or in other words, if the current line is
-" 	something like |10 error|, then we want to count the number of
-" 	lines in the quickfix window before this line which also contain lines
-" 	like |10 error|. 
+" Description:
+"   The purpose of this function is to count the number of times an error
+"   occurs on the same line. or in other words, if the current line is
+"   something like |10 error|, then we want to count the number of
+"   lines in the quickfix window before this line which also contain lines
+"   like |10 error|.
 "
 function! Tex_PositionPreviewWindow(filename)
 
@@ -760,12 +759,12 @@
 
 endfunction " }}}
 " Tex_UpdatePreviewWindow: updates the view of the log file {{{
-" Description: 
+" Description:
 "       This function should be called when focus is in a quickfix window.
 "       It opens the log file in a preview window and makes it display that
 "       part of the log file which corresponds to the error which the user is
 "       currently on in the quickfix window. Control returns to the quickfix
-"       window when the function returns. 
+"       window when the function returns.
 "
 function! Tex_UpdatePreviewWindow(filename)
 	call Tex_PositionPreviewWindow(a:filename)
@@ -776,12 +775,12 @@
 	endif
 endfunction " }}}
 " Tex_GotoErrorLocation: goes to the correct location of error in the tex file {{{
-" Description: 
+" Description:
 "   This function should be called when focus is in a quickfix window. This
 "   function will first open the preview window of the log file (if it is not
 "   already open), position the display of the preview to coincide with the
 "   current error under the cursor and then take the user to the file in
-"   which this error has occured. 
+"   which this error has occured.
 "
 "   The position is both the correct line number and the column number.
 function! Tex_GotoErrorLocation(filename)
@@ -792,7 +791,7 @@
 	exec "normal! \<enter>"
 	" If the log file is not found, then going to the correct line number is
 	" all we can do.
- 	if glob(a:filename) == ''
+	if glob(a:filename) == ''
 		return
 	endif
 
@@ -808,7 +807,7 @@
 
 		let brokenline = matchstr(getline('.'), 'l.'.linenum.' \zs.*\ze')
 		" If the line is of the form
-		" 	l.10 ...and then there was some error
+		"   l.10 ...and then there was some error
 		" it means (most probably) that only part of the erroneous line is
 		" shown. In this case, finding the length of the broken line is not
 		" correct.  Instead goto the beginning of the line and search forward
@@ -841,7 +840,7 @@
 	endif
 endfunction " }}}
 " Tex_SetCompilerMaps: sets maps for compiling/viewing/searching {{{
-" Description: 
+" Description:
 function! <SID>Tex_SetCompilerMaps()
 	if exists('b:Tex_doneCompilerMaps')
 		return
@@ -857,12 +856,12 @@
 	call Tex_MakeMap(s:ml."ll", "<Plug>Tex_Compile", 'v', '<buffer>')
 	call Tex_MakeMap(s:ml."lv", "<Plug>Tex_View", 'n', '<buffer>')
 	call Tex_MakeMap(s:ml."ls", "<Plug>Tex_ForwardSearch", 'n', '<buffer>')
-endfunction 
+endfunction
 " }}}
 
 augroup LatexSuite
-	au LatexSuite User LatexSuiteFileType 
-		\ call Tex_Debug('compiler.vim: Catching LatexSuiteFileType event', 'comp') | 
+	au LatexSuite User LatexSuiteFileType
+		\ call Tex_Debug('compiler.vim: Catching LatexSuiteFileType event', 'comp') |
 		\ call <SID>Tex_SetCompilerMaps()
 augroup END
 
