Thread: [Vim-latex-cvs] vimfiles/ftplugin/latex-suite packages.vim,1.20,1.21
Brought to you by:
srinathava,
tmaas
From: <mi...@us...> - 2003-01-14 13:40:43
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv19148 Modified Files: packages.vim Log Message: - Added to Tex_pack_all() scanning for \newenvironment and \newcommand lines and adds new names to g:Tex_Prompted variables. - Updating is based on g:Tex_...Default, whole scanning is done from nil, thus it should work for removing \new..., but it doesn't work :( It looks like SetUp...Prompt uses some cached values. Index: packages.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/packages.vim,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** packages.vim 12 Jan 2003 22:02:40 -0000 1.20 --- packages.vim 14 Jan 2003 13:40:39 -0000 1.21 *************** *** 124,127 **** --- 124,130 ---- " and if supported, loads the options and commands found in the " corresponding package file. + " Now scans also for \newenvironment and \newcommand lines and adds names to + " g:Tex_Prompted variables, they can be easy available through <F5> and <F7> + " shortcuts function! Tex_pack_all() *************** *** 143,146 **** --- 146,150 ---- 0 let beginline = search('\\begin{document}', 'W') + let endline = search('\\end{document}', 'W') 0 *************** *** 189,192 **** --- 193,230 ---- endwhile + + " Scans whole file (up to \end{document}) for \newcommand and adds this + " commands to g:Tex_PromptedCommands variable, it is easily available + " through <F7> + 0 + let s:Tex_LookForCommand = g:Tex_PromptedCommandsDefault + while search('^\s*\\newcommand\*\?{.\{-}}', 'W') + + if line('.') > endline + break + endif + + let newcommand = matchstr(getline('.'), '\\newcommand\*\?{\\\zs.\{-}\ze}') + let s:Tex_LookForCommand = s:Tex_LookForCommand . ',' . newcommand + + endwhile + let g:Tex_PromptedCommands = s:Tex_LookForCommand + + " Scans whole file (up to \end{document}) for \newenvironment and adds this + " environments to g:Tex_PromptedEnvironments variable, it is easily available + " through <F5> + 0 + let s:Tex_LookForEnvironment = g:Tex_PromptedEnvironmentsDefault + while search('^\s*\\newenvironment\*\?{.\{-}}', 'W') + + if line('.') > endline + break + endif + + let newenvironment = matchstr(getline('.'), '\\newenvironment\*\?{\zs.\{-}\ze}') + let s:Tex_LookForEnvironment = s:Tex_LookForEnvironment . ',' . newenvironment + + endwhile + let g:Tex_PromptedEnvironments = s:Tex_LookForEnvironment if toquit |
From: Benji F. <be...@me...> - 2003-01-14 14:14:12
|
mi...@us... wrote: > Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite > In directory sc8-pr-cvs1:/tmp/cvs-serv19148 > > Modified Files: > packages.vim > Log Message: > - Added to Tex_pack_all() scanning for \newenvironment and \newcommand > lines and adds new names to g:Tex_Prompted variables. > - Updating is based on g:Tex_...Default, whole scanning is done from > nil, thus it should work for removing \new..., but it doesn't work :( > It looks like SetUp...Prompt uses some cached values. I did not follow that. If you need help with this, please state the problem more explicitly. --Benji |
From: Mikolaj M. <mi...@wp...> - 2003-01-14 18:35:15
|
On Tue, Jan 14, 2003 at 09:24:24AM -0500, Benji Fisher wrote: > >- Updating is based on g:Tex_...Default, whole scanning is done from > > nil, thus it should work for removing \new..., but it doesn't work :( > > It looks like SetUp...Prompt uses some cached values. > I did not follow that. If you need help with this, please state > the problem more explicitly. 1. Open file with some \newcommand or \newenvironment commands. 2. :echo g:Tex_PromptedCommands 3. Press <F7>. You will see menu. In this menu you will see also commands defined with \newcommand (the same commands should be in 2.) 4. Delete or comment one of \newcommand lines. 5. Make TeX-Packages->UpdateAll 6. :echo g:Tex_PromptedCommands you will see, command defined in deleted line(s) does not appear there 7. Press <F7>. You will see the same menu as in 2. Mikolaj |
From: Srinath A. <sr...@fa...> - 2003-01-14 19:24:58
|
Well, a quick overview of your changes to envmacros.vim reveals the following code: if !exists('s:common_com_prompt') call SetUpCommandPrompt() endif in PromptForCommand()... Which ofcourse means that s:common_com_prompt is initialized only once! Also, could you please verify that you have tested the new functionality you have added? I am going to be fixing the "`g problem which was recently reported and will make a release, but don't want to do it if there are still bugs you know about... HTH Srinath On Tue, 14 Jan 2003, Mikolaj Machowski wrote: > On Tue, Jan 14, 2003 at 09:24:24AM -0500, Benji Fisher wrote: > > >- Updating is based on g:Tex_...Default, whole scanning is done from > > > nil, thus it should work for removing \new..., but it doesn't work :( > > > It looks like SetUp...Prompt uses some cached values. > > I did not follow that. If you need help with this, please state > > the problem more explicitly. > > 1. Open file with some \newcommand or \newenvironment commands. > 2. :echo g:Tex_PromptedCommands > 3. Press <F7>. You will see menu. In this menu you will see also > commands defined with \newcommand (the same commands should be in 2.) > 4. Delete or comment one of \newcommand lines. > 5. Make TeX-Packages->UpdateAll > 6. :echo g:Tex_PromptedCommands > you will see, command defined in deleted line(s) does not appear > there > 7. Press <F7>. You will see the same menu as in 2. > > Mikolaj > > > ------------------------------------------------------- > This SF.NET email is sponsored by: Take your first step towards giving > your online business a competitive advantage. Test-drive a Thawte SSL > certificate - our easy online guide will show you how. Click here to get > started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en > _______________________________________________ > Vim-latex-cvs mailing list > Vim...@li... > https://lists.sourceforge.net/lists/listinfo/vim-latex-cvs > > |
From: Mikolaj M. <mi...@wp...> - 2003-01-14 23:56:45
|
On Tue, Jan 14, 2003 at 11:24:55AM -0800, Srinath Avadhanula wrote: > Well, a quick overview of your changes to envmacros.vim reveals the > following code: > if !exists('s:common_com_prompt') > call SetUpCommandPrompt() > endif > in PromptForCommand()... > Which ofcourse means that s:common_com_prompt is initialized only once! But even commenting if construction behaviour is still the same... > Also, could you please verify that you have tested the new functionality > you have added? I am going to be fixing the "`g problem which was > recently reported and will make a release, but don't want to do it if > there are still bugs you know about... I tested it and don't know about more bugs. For sure I'll delete some "loose ends" for math commands. m. |
From: Srinath A. <sr...@fa...> - 2003-01-15 01:13:01
|
On Tue, 14 Jan 2003, Mikolaj Machowski wrote: > On Tue, Jan 14, 2003 at 11:24:55AM -0800, Srinath Avadhanula wrote: > > Well, a quick overview of your changes to envmacros.vim reveals the > > following code: > > if !exists('s:common_com_prompt') > > call SetUpCommandPrompt() > > endif > > in PromptForCommand()... > > Which ofcourse means that s:common_com_prompt is initialized only once! > > But even commenting if construction behaviour is still the same... I was trying to debug this... Although I haven't debugged it, I am very curious why you use s: variables at various places in the code... For instance the s:Tex_LookForCommand is used only in Tex_pack_all(), so you should use just a function local variable (no prefix). Are you planning to use this later? Using s: variables makes code look very suspicious... Anyway, I'll release a new version now... Srinath |