On 03/09/08 06:11, Bill McCarthy wrote: > Hello Vim Developers, > > I noticed a global variable that doesn't appear to be > intentionally set. The variable `cpo_save' undecorated and > outside a function is implicitly global. > > Unfortunately `verbose let' does not reveal where it is set. > I found three places - there could be more: > > vim72/ftplugin/hamster.vim > vim72/ftplugin/vim.vim > vim72/plugin/matchparen.vim > > The solution is to (1) prefix with `s:', (2) unlet, or (3) > do both. >
The ":let" statement never remembers where its operand was set (unlike :set, :map, :autocmd, :hi, :function and :command). In this case, the above precautions are prudent, but only really necessary if those scripts can interrupt each other, which I don't think can happen in this case. I believe that in the first two cases above, prefixing with b: might also be a valid solution. Here's the typical use of that variable: let cpo_save = &cpo set cpo&vim ... the bulk of the script comes here ... let &cpo = cpo_save Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 159. You get excited whenever discussing your hard drive. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---