Loading ...
Sorry, an error occurred while loading the content.

51947Re: Global cpo_save

Expand Messages
  • Bill McCarthy
    Sep 3, 2008
    • 0 Attachment
      On Tue 2-Sep-08 11:41pm -0600, Tony Mechelynck wrote:
      > On 03/09/08 06:11, Bill McCarthy wrote:

      >> 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.

      > 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.

      Thanks for your and Ben's comments. Of course simply adding
      an "unlet" doesn't solve the problem. The problem is that a
      global is used. If you had a global that stored Captain
      Paul Olsen's SAV(E)ings - it gets wiped out. Globals should be
      used very sparingly and only when necessary.

      Yes, `b:' would be an adequate alternate - although IMHO
      `s:' is more natural. And please `unlet' - I know nobody is
      running a 64k machine anymore, but why waste space?

      Best regards,

      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 7 messages in this topic