On Thursday, September 27, 2012 11:04:05 PM UTC-5, Gary Johnson wrote:
> I was working on some code that set b:undo_ftplugin, but it didn't
> 
> have any effect when I set a new filetype.  I copied
> 
> $VIMRUNTIME/ftplugin.vim to ~/.vim and instrumented the section that
> 
> is supposed to execute b:undo_ftplugin.
> 
> 
> 
>       func! s:LoadFTPlugin()
> 
>         echo "In s:LoadFTPlugin()" | sleep 2
> 
>         echo "b:undo_ftplugin is" b:undo_ftplugin | sleep 2
> 
>         if exists("b:undo_ftplugin")
> 
>           echo "b:undo_ftplugin exists" | sleep 2
> 
>           exe b:undo_ftplugin
> 
>           unlet! b:undo_ftplugin b:did_ftplugin
> 
>         endif
> 
> 
> 
> Whenever I open a new file for which Vim can detect the filetype, or
> 
> :edit some file, I always get the following errors.
> 
> 
> 
>     Error detected while processing function <SNR>5_LoadFTPlugin:
> 
>     line    2:
> 
>     E121: Undefined variable: b:undo_ftplugin
> 
>     E15: Invalid expression: b:undo_ftplugin | sleep 2
> 
> 
> 
> That is even after I execute
> 
> 
> 
>     :echo b:undo_ftplugin
> 
> 
> 
> and verify that it is set correctly according to the new filetype.
> 
> 
> 
> It seems that b:undo_ftplugin does not exist in the environment in
> 
> which s:LoadFTPlugin() is executed.  Does setting b:undo_ftplugin as
> 
> most current ftplugin scripts do actually do anything?
> 
> 

I wondered if using b:undo_indent worked any better, since arguably that is the 
correct method. But experimentation shows it doesn't work any better. I'm 
guessing from the patch later in the thread that the buffer-local variables are 
getting wiped out but not the buffer-local options.

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui