Re: [Vim-latex-devel] new version of imaps.vim
Brought to you by:
srinathava,
tmaas
From: Benji F. <be...@me...> - 2002-12-15 03:04:44
|
Srinath Avadhanula wrote: > This is bad! We have a problem with vim's limitation of only letting > functions take upto 20 arguments... Ouch. I forgot about that. :-( > On Sat, 14 Dec 2002, Benji Fisher wrote: > > >>>NOTE: This is a work in progress. the changed version of Tex_IMAP() is not >>>yet working quite robustly enought. It is sometimes generating more >>>arguments than are needed. >> >> Examples? Maybe my simplified version will work better. > > > Thanks for the simplifications! Turns out the Tex_IMAP() function was > fine. But the following > > call Tex_IMAP('EPI', "\\begin{picture}(<+width+>, <+height+>)" > \ . "(<+xoff+>,<+yoff+>)\<cr>\\put(<+xoff+>,<+yoff+>)" > \ . "{\\framebox(<++>,<++>){<++>}}\<cr>\\end{picture}<++>", > \ 'tex') > > creates more than 20 arguments! Just barely... > Now what? A long term solution to this problem is ofcourse changing vim > to be more script friendly and accept more than 20 arguments (Its bad > that there are limitations in the first place!). But I suspect that Bram > will most probably ask us to use some hack to get around the limitation > rather than change things... And even if he does change it, it will be > bad to make latex-suite depend on the very latest vim being installed. The last point is a good one. No, we have to find a way with vim as it is. > So... Whats the hack around it? > > Maybe if IMAP() is called with the same LHS more than once, it appends > this RHS to the previous RHS? Then change Tex_IMAP() to call > IMAP() with chunks of 20 arguments each time? This is sad... A simple > function getting needlessly complex. Too complex. Maybe we should abandon the variable-argument idea and go back to the drawing board. How about :fun! IMAP(lhs, rhs, ft, ...) compatible with the original, but allowing optional place-holders? In other words, use the calling pattern that you came up with for Tex_IMAPS(). > I'll let others think about it / implement it :) > > About imaps... For sometime I have been thinking of having IMAPS() take > a flag which makes it "safe", i.e if the user defines other mappings > with the same LHS before latex-suite, it will not override his > mappings... Now the flag argument could also be useful for telling us > whether this is part of an append or an entirely new RHS... The flag > cannot be optional. It will have to be left as '' if we just want it to > overwrite like now. I think that this should be implemented by a variable, [bg]:Imap_noclobber or some such. The user is not going to change all the calls to IMAP() in the latex-suite files. >> Can you test this? It might be a solution to the remaining >>encoding problems. >> >>:let foo = "\xab" >>:echo iconv(foo, "latin1", &enc) =~ foo > > Yes. This seems to echo 1 with encoding set to both 'latin1' and > 'utf8'... Good. According to the docs, iconv() should always be able to convert between utf-8 and latin1. That is almost as good as knowing that we can convert between these and &enc. > Another thing to note: There seem to be a lot of patches in vim 6.0 > towards MB chars... Therefore, maybe we should only test on vim 6.0 w/o > patches henceforth, so we have the safest... I guess I should boot into W95 from time to time. I have an unpatched 6.1 there; I could install an unpatched 6.0 as well... --Benji |