Re: [Vim-latex-cvs] vimfiles/ftplugin/latex-suite/packages ngerman,NONE,1.1
Brought to you by:
srinathava,
tmaas
|
From: Srinath A. <sr...@fa...> - 2003-01-16 07:02:04
|
On Wed, 15 Jan 2003, Benji Fisher wrote:
> I was thinking that if babel is one of the packages found, then
> whatever language is given as an option should be added as a package.
> If the file contains
>
> \usepackage[foo]{babel}
>
> then pretend that it includes
>
> \usepackage{foo}
This is still going to require that we scan for options and create a
variable such as g:Tex_{package}_options
Now Tex_pack_all() scans the file looking for \usepackage's... I do not
think it will be a good idea to make it also do something based on which
pacakges it found and what options were used in each etc. That approach
will mean that each time we come across a new issue like this, we will
have to change that function...
What about something more "long term"... I was recently looking at the
excellent cvscommand.vim plugin and one thing which that plugin uses,
which we haven't done so far is user generated autcommands... I think
using this mechanism is one way to go... After the initial scan for
\usepackage's, Tex_pack_all() throws an event:
silent! do TexPackages User TexPackagesScanned
If a package wants to, it can catch this event. For example,
packages/babel could do:
augroup TexPackages
au TexPackages User TexPackagesScanned call SetQuotes()
augroup END
fun! SetQuotes()
if g:Tex_pack_supported =~ babel
if g:Tex_babel_option =~ 'german'
let open = "\"`"
let close = "\"'"
elseif g:Tex_babel_option =~ 'french'
let open = '<<'
let close = '>>'
endif
endif
endfun
This mechanism effectively lets each package work for itself without
making Tex_pack_all() do it...
> Perhaps one way to do this would be to add a packages/babel file that
> finds the options, and fakes including the packages.
The package files should not be required to scan for \usepackage's and
what options were used etc. That should be done by some latex-suite
function like Tex_pack_all(). The package files should only have the
intelligence to use this information in some way...
Although this mechanism might seem complicated at first glance, I do not
think it is... The advantage is that it will be eminently scalable...
Using this mechanism, we might even have gotten away with not creating
the german and ngerman packages at all... Just creating the SetQuotes
function and the autocommand above would have been sufficient...
Srinath
|