Hi list,

there have been a couple of reports on the F9-completion not working properly in \cite{} recently. Since I have been bitten myself, I've taken a look at the problem. Seems at one point the recent fnameescape-patch overlooked to expand a string before escaping, and on two occasions the same cd-related bug that I've reported in my other email hit in the completion code.

I have tested this with vim-latex-1.5-20090804-r1058 and vim 7.1.138 and vim 7.2.22. The error message was something like:

Error detected while processing function Tex_Complete:
line    9:
E15: Invalid expression: %:p:h)
E116: Invalid arguments for function fnameescape(%:p:h)
E15: Invalid expression: 'cd '.fnameescape(%:p:h)
line   74:
E344: Can't find directory "s:origdir" in cdpath
E472: Command failed

I've included a patch against vim-latex-1.5-20090804-r1058 that fixes this problem for me.


Cheers,
Alex
--- ftplugin/latex-suite/texviewer.vim 13:12:22.000000000 +0200
+++ ftplugin/latex-suite/texviewer.vim 13:13:03.000000000 +0200
@@ -45,7 +45,7 @@
 	" :grep commands. We will change back to the original directory after we
 	" finish with the grep.
 	let s:origdir = fnameescape(getcwd())
-	exe 'cd '.fnameescape(%:p:h)
+	exe 'cd '.fnameescape(expand("%:p:h"))
 
 	let s:pos = Tex_GetPos()
 
@@ -110,12 +110,12 @@
 			if has('python') && Tex_GetVarValue('Tex_UsePython') 
 				\ && Tex_GetVarValue('Tex_UseCiteCompletionVer2') == 1
 
-				cd s:origdir
+				exe 'cd '.s:origdir
 				silent! call Tex_StartCiteCompletion()
 
 			elseif Tex_GetVarValue('Tex_UseJabref') == 1
 
-				cd s:origdir
+				exe 'cd '.s:origdir
 				let g:Remote_WaitingForCite = 1
 				let citation = input('Enter citation from jabref (<enter> to leave blank): ')
 				let g:Remote_WaitingForCite = 0
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Vim-latex-devel mailing list
Vim-latex-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vim-latex-devel

Reply via email to