Re: How can I force no undo dunring a function call?
- View SourceMario Schweigler wrote:
>It works as expected for me. Maybe the problem is somewhere else. I tried
> I want the following: When I call a function, I would like that
> afterwards the undo buffer is empty, i.e. I can't undo the stuff that
> the function has changed.
> But if I change something manually later, it must be undoable just like
> I tried
> :let save_ul = &undolevels
> :setlocal undolevels=-1
> at the beginning of the function and
> :exe 'setlocal undolevels=' . save_ul
> at the end of the function. But it does not work! If I press u after
> calling the function it still undoes the function's changes.
After :call UndoTest() I get an extra line, and "u" does not make it go away.
BTW, I used :setlocal because you did, but 'ul' is a global option, so this
should work just the same as :set .
HTH --Benji Fisher