Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1:/tmp/cvs-serv25158
Modified Files:
custommacros.vim main.vim packages.vim texproject.vim
Log Message:
Yet more changes in the effort to make latex-suite support file names with
spaces. A new function ``Tex_EscapeSpaces`` which escapes spaces *only if
necessary*. This function should henceforth be used whenever we want to
split a new file, save a file etc etc. Example::
exec 'split '.Tex_EscapeSpaces(filename)
Index: custommacros.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/custommacros.vim,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** custommacros.vim 14 Dec 2003 22:08:48 -0000 1.19
--- custommacros.vim 15 Dec 2003 03:33:52 -0000 1.20
***************
*** 77,81 ****
endif
endif
! exe 'split '.s:macrodirpath.newmacroname
setlocal filetype=tex
endfunction
--- 77,81 ----
endif
endif
! exec 'split '.Tex_EscapeSpaces(s:macrodirpath.newmacroname)
setlocal filetype=tex
endfunction
***************
*** 134,138 ****
if filereadable(s:macrodirpath.filename)
" If file exists in local directory open it.
! exe 'split '.s:macrodirpath.filename
else
" But if file doesn't exist in local dir it probably is in user
--- 134,138 ----
if filereadable(s:macrodirpath.filename)
" If file exists in local directory open it.
! exec 'split '.Tex_EscapeSpaces(s:macrodirpath.filename)
else
" But if file doesn't exist in local dir it probably is in user
***************
*** 152,156 ****
\ "&Open\nOver&write\n&Cancel", 1)
if ch == 1
! exe 'split '.s:macrodirpath.filename.'-local'
elseif ch == 2
new
--- 152,156 ----
\ "&Open\nOver&write\n&Cancel", 1)
if ch == 1
! exec 'split '.Tex_EscapeSpaces(s:macrodirpath.filename.'-local')
elseif ch == 2
new
Index: main.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/main.vim,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** main.vim 15 Dec 2003 00:53:27 -0000 1.57
--- main.vim 15 Dec 2003 03:33:52 -0000 1.58
***************
*** 592,596 ****
\ . pattern.' : '.a:str."\n"
! " exec '!echo '.pattern.' : '.a:str.' >> /tmp/ls.log'
endfunction " }}}
" Tex_PrintDebug: prings s:debugString {{{
--- 592,598 ----
\ . pattern.' : '.a:str."\n"
! redir! >> /tmp/ls.log
! silent! echo pattern.' : '.a:str
! redir END
endfunction " }}}
" Tex_PrintDebug: prings s:debugString {{{
***************
*** 642,646 ****
let filelist = globpath(&rtp, 'ftplugin/latex-suite/'.a:directory.'/'.pattern)."\n"
- call Tex_Debug("filelist = ".filelist, "main")
if filelist == "\n"
--- 644,647 ----
***************
*** 716,720 ****
" " Description:
function! Tex_CD(dirname)
! exec 'cd '.escape(a:dirname, ' ')
endfunction " }}}
--- 717,726 ----
" " Description:
function! Tex_CD(dirname)
! exec 'cd '.Tex_EscapeSpaces(a:dirname)
! endfunction " }}}
! " Tex_EscapeSpaces: escapes unescaped spaces from a path name {{{
! " Description:
! function! Tex_EscapeSpaces(path)
! return substitute(a:path, '[^\\]\(\\\\\)*\zs ', '\\ ', 'g')
endfunction " }}}
Index: packages.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/packages.vim,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** packages.vim 14 Dec 2003 07:22:16 -0000 1.43
--- packages.vim 15 Dec 2003 03:33:52 -0000 1.44
***************
*** 116,120 ****
" Find out which file we need to scan.
! let fname = escape(Tex_GetMainFileName(':p'), ' ')
" If this is the same as last time, don't repeat.
--- 116,120 ----
" Find out which file we need to scan.
! let fname = Tex_GetMainFileName(':p')
" If this is the same as last time, don't repeat.
***************
*** 139,144 ****
let g:Tex_PromptedCommands = g:Tex_PromptedCommandsDefault
! call Tex_ScanForPackages(fname)
! call Tex_Debug('updateall: detected ['.g:Tex_package_detected.'] in first run', 'pack')
" Now for each package find out if this is a custom package and if so,
--- 139,148 ----
let g:Tex_PromptedCommands = g:Tex_PromptedCommandsDefault
! call Tex_Debug(':Tex_pack_updateall: split '.Tex_EscapeSpaces(fname), 'pack')
! exe 'split '.Tex_EscapeSpaces(fname)
! call Tex_ScanForPackages()
! q
!
! call Tex_Debug(':Tex_pack_updateall: detected ['.g:Tex_package_detected.'] in first run', 'pack')
" Now for each package find out if this is a custom package and if so,
***************
*** 164,168 ****
while packname != ''
! call Tex_Debug('scanning package '.packname, 'pack')
" Scan this package only if we have not scanned it before in this
--- 168,172 ----
while packname != ''
! call Tex_Debug(':Tex_pack_updateall: scanning package '.packname, 'pack')
" Scan this package only if we have not scanned it before in this
***************
*** 171,175 ****
let i = i + 1
! call Tex_Debug(packname.' already scanned', 'pack')
let packname = Tex_Strntok(g:Tex_package_detected, ',', i)
continue
--- 175,179 ----
let i = i + 1
! call Tex_Debug(':Tex_pack_updateall: '.packname.' already scanned', 'pack')
let packname = Tex_Strntok(g:Tex_package_detected, ',', i)
continue
***************
*** 181,188 ****
split
! call Tex_Debug('silent! find '.packname.'.sty', 'pack')
let thisbufnum = bufnr('%')
! exec 'silent! find '.packname.'.sty'
! call Tex_Debug('present file = '.bufname('%'), 'pack')
" If this file was not found, assume that it means its not a
--- 185,192 ----
split
! call Tex_Debug(':Tex_pack_updateall: silent! find '.Tex_EscapeSpaces(packname).'.sty', 'pack')
let thisbufnum = bufnr('%')
! exec 'silent! find '.Tex_EscapeSpaces(packname).'.sty'
! call Tex_Debug(':Tex_pack_updateall: present file = '.bufname('%'), 'pack')
" If this file was not found, assume that it means its not a
***************
*** 194,198 ****
q
! call Tex_Debug(packname.' not found anywhere', 'pack')
let i = i + 1
let packname = Tex_Strntok(g:Tex_package_detected, ',', i)
--- 198,202 ----
q
! call Tex_Debug(':Tex_pack_updateall: '.packname.' not found anywhere', 'pack')
let i = i + 1
let packname = Tex_Strntok(g:Tex_package_detected, ',', i)
***************
*** 205,211 ****
let &complete = &complete.'s'.packpath
! call Tex_Debug('found custom package '.packpath, 'pack')
! call Tex_ScanForPackages(packpath, line('$'), line('$'))
! call Tex_Debug('After scanning, g:Tex_package_detected = '.g:Tex_package_detected, 'pack')
let scannedPackages = scannedPackages.','.packname
--- 209,215 ----
let &complete = &complete.'s'.packpath
! call Tex_Debug(':Tex_pack_updateall: found custom package '.packpath, 'pack')
! call Tex_ScanForPackages(line('$'), line('$'))
! call Tex_Debug(':Tex_pack_updateall: After scanning, g:Tex_package_detected = '.g:Tex_package_detected, 'pack')
let scannedPackages = scannedPackages.','.packname
***************
*** 248,252 ****
--- 252,259 ----
" Throw an event that we are done scanning packages. Some packages might
" use this to change behavior based on which options have been used etc.
+ call Tex_Debug(":Tex_pack_updateall: throwing LatexSuiteScannedPackages event", "pack")
silent! do LatexSuite User LatexSuiteScannedPackages
+
+ call Tex_Debug("-Tex_pack_updateall", "pack")
endfunction
***************
*** 298,311 ****
" \newcommand lines and adds names to g:Tex_Prompted variables, they can be
" easy available through <F5> and <F7> shortcuts
! function! Tex_ScanForPackages(fname, ...)
! let pos = line('.').' | normal! '.virtcol('.').'|'
! let currfile = escape(expand('%:p'), ' ')
! call Tex_Debug('currfile = '.currfile.', a:fname = '.a:fname, 'pack')
! let toquit = 0
! if a:fname != currfile
! exe 'split '.a:fname
! let toquit = 1
! endif
" For package files without \begin and \end{document}, we might be told to
--- 305,312 ----
" \newcommand lines and adds names to g:Tex_Prompted variables, they can be
" easy available through <F5> and <F7> shortcuts
! function! Tex_ScanForPackages(...)
! call Tex_Debug("+Tex_ScanForPackages", "pack")
! let pos = line('.').' | normal! '.virtcol('.').'|'
" For package files without \begin and \end{document}, we might be told to
***************
*** 320,324 ****
let endline = a:2
endif
! call Tex_Debug('beginline = '.beginline.', endline = '.endline, 'pack')
--- 321,326 ----
let endline = a:2
endif
!
! call Tex_Debug(":Tex_ScanForPackages: Begining scans in [".bufname('%')."], beginline = ".beginline, "pack")
***************
*** 330,333 ****
--- 332,336 ----
let v:errmsg = erm
+ call Tex_Debug(":Tex_ScanForPackages: beginning scan for \\usepackage lines", "pack")
" The wrap trick enables us to match \usepackage on the first line as
" well.
***************
*** 336,340 ****
let wrap = 'W'
- call Tex_Debug('finding package on '.line('.'), 'pack')
if line('.') > beginline
break
--- 339,342 ----
***************
*** 389,395 ****
--- 391,400 ----
let @a = substitute(@a, ',', '","', 'g')
+ call Tex_Debug(":Tex_ScanForPackages: found package(s) [".@a."] on line ".line('.'), "pack")
+
" restore @a
let @a = saveA
endwhile
+ call Tex_Debug(":Tex_ScanForPackages: End scan \\usepackage, detected packages = ".g:Tex_package_detected, "pack")
" TODO: This needs to be changed. In the future, we might have
***************
*** 404,407 ****
--- 409,413 ----
let g:Tex_package_detected = substitute(g:Tex_package_detected, '^,', '', '')
+ call Tex_Debug(":Tex_ScanForPackages: Beginning scan for \\newcommand's", "pack")
" Scans whole file (up to \end{document}) for \newcommand and adds this
" commands to g:Tex_PromptedCommands variable, it is easily available
***************
*** 423,427 ****
" through <F5>
0
! call Tex_Debug('looking for newenvironments in '.bufname('%'), 'pack')
while search('^\s*\\newenvironment\*\?{.\{-}}', 'W')
--- 429,433 ----
" through <F5>
0
! call Tex_Debug(":Tex_ScanForPackages: Beginning scan for \\newenvironment's", 'pack')
while search('^\s*\\newenvironment\*\?{.\{-}}', 'W')
***************
*** 437,445 ****
endwhile
- if toquit
- call Tex_Debug("quitting from ".bufname('%'), "pack")
- q
- endif
-
exe pos
" first make a random search so that we push at least one item onto the
--- 443,446 ----
***************
*** 450,453 ****
--- 451,456 ----
" now delete it...
call histdel('/', -1)
+
+ call Tex_Debug("-Tex_ScanForPackages", "pack")
endfunction
***************
*** 458,462 ****
function! Tex_pack_supp_menu()
let suplist = Tex_FindInRtp('', 'packages')
- call Tex_Debug("suplist = [".suplist.']', "pack")
call Tex_MakeSubmenu(suplist, g:Tex_PackagesMenuLocation.'Supported.',
--- 461,464 ----
Index: texproject.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/texproject.vim,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** texproject.vim 14 Dec 2003 07:23:55 -0000 1.4
--- texproject.vim 15 Dec 2003 03:33:52 -0000 1.5
***************
*** 25,32 ****
let mainfname = Tex_GetMainFileName()
if glob(mainfname.'.latexmain') != ''
! exe 'split '.mainfname.'.latexmain'
else
! exe 'split '.escape(s:path.'/projecttemplate.vim', ' ')
! exe 'saveas '.escape(file.'.latexmain', ' ')
let g:Tex_ProjectExists = 1
endif
--- 25,32 ----
let mainfname = Tex_GetMainFileName()
if glob(mainfname.'.latexmain') != ''
! exec 'split '.Tex_EscapeSpaces(mainfname.'.latexmain')
else
! exec 'split '.Tex_EscapeSpaces(s:path.'/projecttemplate.vim')
! exec 'saveas '.Tex_EscapeSpaces(file.'.latexmain')
let g:Tex_ProjectExists = 1
endif
|