On 2006-08-21, "A.J.Mechelynck" <[EMAIL PROTECTED]> wrote:
> Preben Randhol wrote:
> > Hi again
> >
> > I have another question...
> >
> > I'm trying to make a function to open files for editing from a function.
> > however I keep getting an error. I have included a very simple functions
> > that gives the same error message. I understand that one cannot do it
> > this way, but I don't know how to do it:
> >
> > function! Read_test()
> > execute "e somefile"
> > endfunction
> >
> > I get this error:
> >
> > E127: Cannot redefine function Read_test: It is in use
> >
> > Any hints much appreciated
> >
> > Preben
> >
> >
>
> The function definition must not be in a script or function which is
> called from an autocommand which is triggered by opening a file for editing.
There are a number of ways you (Preben) can get around that. Not
knowing exactly what you're trying to do, I don't know which to
suggest, but here's one solution:
if !exists("*Read_test")
function Read_test()
execute "e somefile"
endfunction
endif
HTH,
Gary
--
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Wireless Division
| Spokane, Washington, USA