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

Patch 7.4.264

Expand Messages
  • Bram Moolenaar
    Patch 7.4.264 (after 7.4.260) Problem: Can t define a function starting with g: . Can t assign a funcref to a buffer-local variable. Solution: Skip g:
    Message 1 of 22 , Apr 23, 2014
    • 0 Attachment
      Patch 7.4.264 (after 7.4.260)
      Problem: Can't define a function starting with "g:". Can't assign a
      funcref to a buffer-local variable.
      Solution: Skip "g:" at the start of a function name. Don't check for colons
      when assigning to a variable.
      Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok


      *** ../vim-7.4.263/src/eval.c 2014-04-23 19:44:26.366774008 +0200
      --- src/eval.c 2014-04-23 20:40:16.738693276 +0200
      ***************
      *** 21583,21589 ****
      * Get the function name. There are these situations:
      * func normal function name
      * "name" == func, "fudi.fd_dict" == NULL
      - * s:func script-local function name
      * dict.func new dictionary entry
      * "name" == NULL, "fudi.fd_dict" set,
      * "fudi.fd_di" == NULL, "fudi.fd_newkey" == func
      --- 21583,21588 ----
      ***************
      *** 21593,21598 ****
      --- 21592,21599 ----
      * dict.func existing dict entry that's not a Funcref
      * "name" == NULL, "fudi.fd_dict" set,
      * "fudi.fd_di" set, "fudi.fd_newkey" == NULL
      + * s:func script-local function name
      + * g:func global function name, same as "func"
      */
      p = eap->arg;
      name = trans_function_name(&p, eap->skip, 0, &fudi);
      ***************
      *** 22286,22292 ****
      }
      else
      {
      ! if (lead == 2) /* skip over "s:" */
      lv.ll_name += 2;
      len = (int)(end - lv.ll_name);
      }
      --- 22287,22294 ----
      }
      else
      {
      ! /* skip over "s:" and "g:" */
      ! if (lead == 2 || (lv.ll_name[0] == 'g' && lv.ll_name[1] == ':'))
      lv.ll_name += 2;
      len = (int)(end - lv.ll_name);
      }
      ***************
      *** 22317,22333 ****
      else if (!(flags & TFN_INT) && builtin_function(lv.ll_name, len))
      {
      EMSG2(_("E128: Function name must start with a capital or \"s:\": %s"),
      ! lv.ll_name);
      goto theend;
      }
      ! if (!skip)
      {
      char_u *cp = vim_strchr(lv.ll_name, ':');

      if (cp != NULL && cp < end)
      {
      ! EMSG2(_("E884: Function name cannot contain a colon: %s"),
      ! lv.ll_name);
      goto theend;
      }
      }
      --- 22319,22334 ----
      else if (!(flags & TFN_INT) && builtin_function(lv.ll_name, len))
      {
      EMSG2(_("E128: Function name must start with a capital or \"s:\": %s"),
      ! start);
      goto theend;
      }
      ! if (!skip && !(flags & TFN_QUIET))
      {
      char_u *cp = vim_strchr(lv.ll_name, ':');

      if (cp != NULL && cp < end)
      {
      ! EMSG2(_("E884: Function name cannot contain a colon: %s"), start);
      goto theend;
      }
      }
      *** ../vim-7.4.263/src/testdir/test_eval.in 2014-04-23 17:43:37.362948683 +0200
      --- src/testdir/test_eval.in 2014-04-23 20:36:50.494698246 +0200
      ***************
      *** 144,150 ****
      :delcommand AR
      :call garbagecollect(1)
      :"
      ! :" function name includes a colon
      :try
      :func! g:test()
      :echo "test"
      --- 144,150 ----
      :delcommand AR
      :call garbagecollect(1)
      :"
      ! :" function name not starting with capital
      :try
      :func! g:test()
      :echo "test"
      ***************
      *** 153,158 ****
      --- 153,167 ----
      :$put =v:exception
      :endtry
      :"
      + :" function name includes a colon
      + :try
      + :func! b:test()
      + :echo "test"
      + :endfunc
      + :catch
      + :$put =v:exception
      + :endtry
      + :"
      :" function name folowed by #
      :try
      :func! test2() "#
      ***************
      *** 162,167 ****
      --- 171,183 ----
      :$put =v:exception
      :endtry
      :"
      + :" function name starting with/without "g:", buffer-local funcref.
      + :function! g:Foo()
      + : $put ='called Foo()'
      + :endfunction
      + :let b:my_func = function('Foo')
      + :call b:my_func()
      + :"
      :/^start:/+1,$wq! test.out
      :" vim: et ts=4 isk-=\: fmr=???,???
      :call getchar()
      *** ../vim-7.4.263/src/testdir/test_eval.ok 2014-04-23 17:43:37.362948683 +0200
      --- src/testdir/test_eval.ok 2014-04-23 20:37:45.526696920 +0200
      ***************
      *** 336,339 ****
      --- 336,341 ----
      Executing call setreg(1, ["", "", [], ""])
      Vim(call):E730: using List as a String
      Vim(function):E128: Function name must start with a capital or "s:": g:test()
      + Vim(function):E128: Function name must start with a capital or "s:": b:test()
      Vim(function):E128: Function name must start with a capital or "s:": test2() "#
      + called Foo()
      *** ../vim-7.4.263/src/version.c 2014-04-23 19:44:26.370774008 +0200
      --- src/version.c 2014-04-23 20:27:17.614712050 +0200
      ***************
      *** 736,737 ****
      --- 736,739 ----
      { /* Add new patch number below this line */
      + /**/
      + 264,
      /**/

      --
      In order for something to become clean, something else must become dirty;
      but you can get everything dirty without getting anything clean.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • LCD 47
      ... [...] Thank you, it s now back to sanity. /lcd -- -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text
      Message 2 of 22 , Apr 23, 2014
      • 0 Attachment
        On 23 April 2014, Bram Moolenaar <Bram@...> wrote:
        >
        > Patch 7.4.264 (after 7.4.260)
        > Problem: Can't define a function starting with "g:". Can't assign a
        > funcref to a buffer-local variable.
        > Solution: Skip "g:" at the start of a function name. Don't check for colons
        > when assigning to a variable.
        [...]

        Thank you, it's now back to sanity.

        /lcd

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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • Matteo Cavalleri
        ... I m still having problems: line 17: E121: Undefined variable: g:vundle_last_status E15: Invalid expression: updated == g:vundle_last_status &&
        Message 3 of 22 , Apr 23, 2014
        • 0 Attachment
          > > Patch 7.4.264 (after 7.4.260)
          >
          > > Problem: Can't define a function starting with "g:". Can't assign a
          >
          > > funcref to a buffer-local variable.
          >
          > > Solution: Skip "g:" at the start of a function name. Don't check for colons
          >
          > > when assigning to a variable.

          I'm still having problems:


          line 17:
          E121: Undefined variable: g:vundle_last_status
          E15: Invalid expression: 'updated' == g:vundle_last_status && empty(msg)
          Error detected while processing function vundle#installer#new..<SNR>106_process.
          .vundle#installer#run..vundle#installer#install..<SNR>106_sync:
          line 6:
          E117: Unknown function: g:shellesc_cd
          E15: Invalid expression: g:shellesc_cd(cmd)
          Error detected while processing function vundle#installer#new..<SNR>106_process:

          line 13:
          E121: Undefined variable: g:vundle_last_status
          E15: Invalid expression: 'error' == g:vundle_last_status
          line 17:
          E121: Undefined variable: g:vundle_last_status
          E15: Invalid expression: 'updated' == g:vundle_last_status && empty(msg)
          Error detected while processing function vundle#installer#new..<SNR>106_process.
          .vundle#installer#run..vundle#installer#install..<SNR>106_sync:
          line 6:
          E117: Unknown function: g:shellesc_cd
          E15: Invalid expression: g:shellesc_cd(cmd)
          Error detected while processing function vundle#installer#new..<SNR>106_process:

          line 13:
          E121: Undefined variable: g:vundle_last_status
          E15: Invalid expression: 'error' == g:vundle_last_status


          the following looks more like it's the script author fault, but I'm not sure if all the errors are due to the illegal function name or not, so I'm pasting them all:


          Error detected while processing /Users/matteo/.vim/bundle/vdebug/plugin/vdebug.vim:
          line 151:
          E128: Function name must start with a capital or "s:": vdebug:get_visual_selection()
          line 155:
          E684: list index out of range: -1
          E15: Invalid expression: lines[-1][: col2 - 1]
          line 156:
          E684: list index out of range: 0
          E15: Invalid expression: lines[0][col1 - 1:]
          line 157:
          E133: :return not inside a function
          line 158:
          E193: :endfunction not inside a function
          line 160:
          E128: Function name must start with a capital or "s:": vdebug:edit(filename)
          line 162:
          E121: Undefined variable: a:filename
          E116: Invalid arguments for function fnameescape(a:filename)
          E15: Invalid expression: fnameescape(a:filename)
          Press ENTER or type command to continue

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

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • Ingo Karkat
          ... Me, too. The following used to work: fun! Foo() endfun let g:Foo = function( Foo ) After 7.4.264, I get: E705: Variable name conflicts with existing
          Message 4 of 22 , Apr 24, 2014
          • 0 Attachment
            On 23-Apr-2014 23:11 +0200, Matteo Cavalleri wrote:

            >>> Patch 7.4.264 (after 7.4.260)
            >>
            >>> Problem: Can't define a function starting with "g:". Can't assign a
            >>
            >>> funcref to a buffer-local variable.
            >>
            >>> Solution: Skip "g:" at the start of a function name. Don't check for colons
            >>
            >>> when assigning to a variable.
            >
            > I'm still having problems:
            >
            >
            > line 17:
            > E121: Undefined variable: g:vundle_last_status
            > E15: Invalid expression: 'updated' == g:vundle_last_status && empty(msg)
            > Error detected while processing function vundle#installer#new..<SNR>106_process.
            > .vundle#installer#run..vundle#installer#install..<SNR>106_sync:
            > line 6:
            > E117: Unknown function: g:shellesc_cd
            > E15: Invalid expression: g:shellesc_cd(cmd)
            > Error detected while processing function vundle#installer#new..<SNR>106_process:
            >
            > line 13:
            > E121: Undefined variable: g:vundle_last_status
            > E15: Invalid expression: 'error' == g:vundle_last_status
            > line 17:
            > E121: Undefined variable: g:vundle_last_status
            > E15: Invalid expression: 'updated' == g:vundle_last_status && empty(msg)
            > Error detected while processing function vundle#installer#new..<SNR>106_process.
            > .vundle#installer#run..vundle#installer#install..<SNR>106_sync:
            > line 6:
            > E117: Unknown function: g:shellesc_cd
            > E15: Invalid expression: g:shellesc_cd(cmd)
            > Error detected while processing function vundle#installer#new..<SNR>106_process:
            >
            > line 13:
            > E121: Undefined variable: g:vundle_last_status
            > E15: Invalid expression: 'error' == g:vundle_last_status
            >
            >
            > the following looks more like it's the script author fault, but I'm not sure if all the errors are due to the illegal function name or not, so I'm pasting them all:
            >
            >
            > Error detected while processing /Users/matteo/.vim/bundle/vdebug/plugin/vdebug.vim:
            > line 151:
            > E128: Function name must start with a capital or "s:": vdebug:get_visual_selection()
            > line 155:
            > E684: list index out of range: -1
            > E15: Invalid expression: lines[-1][: col2 - 1]
            > line 156:
            > E684: list index out of range: 0
            > E15: Invalid expression: lines[0][col1 - 1:]
            > line 157:
            > E133: :return not inside a function
            > line 158:
            > E193: :endfunction not inside a function
            > line 160:
            > E128: Function name must start with a capital or "s:": vdebug:edit(filename)
            > line 162:
            > E121: Undefined variable: a:filename
            > E116: Invalid arguments for function fnameescape(a:filename)
            > E15: Invalid expression: fnameescape(a:filename)
            > Press ENTER or type command to continue

            Me, too. The following used to work:

            fun! Foo()
            endfun
            let g:Foo = function('Foo')

            After 7.4.264, I get:
            " E705: Variable name conflicts with existing function: g:Foo

            In general, I do welcome the introduced restrictions, though, I've found
            a place where I attempted to define a buffer-local function (fun!
            b:Foo()); this is now correctly flagged with E128.

            -- regards, ingo

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

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          • Bram Moolenaar
            ... That is correct. Previously Foo() and g:Foo were different names, which is wrong. Both refer to the same function. ... Right. So the problem is that
            Message 5 of 22 , Apr 24, 2014
            • 0 Attachment
              Ingo Karkat wrote:

              > Me, too. The following used to work:
              >
              > fun! Foo()
              > endfun
              > let g:Foo = function('Foo')
              >
              > After 7.4.264, I get:
              > " E705: Variable name conflicts with existing function: g:Foo

              That is correct. Previously Foo() and g:Foo were different names, which
              is wrong. Both refer to the same function.

              > In general, I do welcome the introduced restrictions, though, I've found
              > a place where I attempted to define a buffer-local function (fun!
              > b:Foo()); this is now correctly flagged with E128.

              Right. So the problem is that users have been using wrong function
              names, and they did work. Now they are flagged as errors, which may
              break some scripts.

              The question is: Is it acceptable to expect users to fix those scripts,
              or do we need to be lenient. A possible way is to add an option to
              allow the wrong names. That's not a nice solution though, it hides the
              actual problem.

              --
              Where do you want to crash today?

              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
              /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
              \\\ an exciting new programming language -- http://www.Zimbu.org ///
              \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

              ---
              You received this message because you are subscribed to the Google Groups "vim_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/d/optout.
            • Ingo Karkat
              ... Ah, okay. I can accept that. What I find inconsistent and strange is that though I can define g:Foo(), I cannot call it with that global-scoped name: fun
              Message 6 of 22 , Apr 24, 2014
              • 0 Attachment
                On 24-Apr-2014 12:43 +0200, Bram Moolenaar wrote:

                > Ingo Karkat wrote:
                >
                >> Me, too. The following used to work:
                >>
                >> fun! Foo()
                >> endfun
                >> let g:Foo = function('Foo')
                >>
                >> After 7.4.264, I get:
                >> " E705: Variable name conflicts with existing function: g:Foo
                >
                > That is correct. Previously Foo() and g:Foo were different names, which
                > is wrong. Both refer to the same function.

                Ah, okay. I can accept that.

                What I find inconsistent and strange is that though I can define
                g:Foo(), I cannot call it with that global-scoped name:

                fun g:Foo()
                return 42
                endfun
                echo Foo()
                42
                echo g:Foo()
                E117: Unknown function: g:Foo
                E15: Invalid expression: g:Foo()

                Not that I personally would use the g:Foo() syntax, but I'm very used to
                calling (script-local) s:Foo(), and this behavior is inconsistent.


                >> In general, I do welcome the introduced restrictions, though, I've found
                >> a place where I attempted to define a buffer-local function (fun!
                >> b:Foo()); this is now correctly flagged with E128.
                >
                > Right. So the problem is that users have been using wrong function
                > names, and they did work. Now they are flagged as errors, which may
                > break some scripts.
                >
                > The question is: Is it acceptable to expect users to fix those scripts,
                > or do we need to be lenient. A possible way is to add an option to
                > allow the wrong names. That's not a nice solution though, it hides the
                > actual problem.

                As these are real bugs, I'm against an option allowing those, too.

                Rather, the help about the error message should provide good
                instructions (drop the invalid scope prefix) so that even casual users
                are able to fix their beloved decades-old plugin that has long been
                abandoned by its original author.

                -- regards, ingo

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

                ---
                You received this message because you are subscribed to the Google Groups "vim_dev" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                For more options, visit https://groups.google.com/d/optout.
              • Bram Moolenaar
                ... I tried this with :call g:Foo() , but it indeed doesn t work when invoking g:Foo() in an expression. I ll fix that. ... Yeah, the help could mention that
                Message 7 of 22 , Apr 24, 2014
                • 0 Attachment
                  Ingo Karkat wrote:

                  > What I find inconsistent and strange is that though I can define
                  > g:Foo(), I cannot call it with that global-scoped name:
                  >
                  > fun g:Foo()
                  > return 42
                  > endfun
                  > echo Foo()
                  > 42
                  > echo g:Foo()
                  > E117: Unknown function: g:Foo
                  > E15: Invalid expression: g:Foo()
                  >
                  > Not that I personally would use the g:Foo() syntax, but I'm very used to
                  > calling (script-local) s:Foo(), and this behavior is inconsistent.

                  I tried this with ":call g:Foo()", but it indeed doesn't work when
                  invoking g:Foo() in an expression. I'll fix that.

                  > >> In general, I do welcome the introduced restrictions, though, I've found
                  > >> a place where I attempted to define a buffer-local function (fun!
                  > >> b:Foo()); this is now correctly flagged with E128.
                  > >
                  > > Right. So the problem is that users have been using wrong function
                  > > names, and they did work. Now they are flagged as errors, which may
                  > > break some scripts.
                  > >
                  > > The question is: Is it acceptable to expect users to fix those scripts,
                  > > or do we need to be lenient. A possible way is to add an option to
                  > > allow the wrong names. That's not a nice solution though, it hides the
                  > > actual problem.
                  >
                  > As these are real bugs, I'm against an option allowing those, too.
                  >
                  > Rather, the help about the error message should provide good
                  > instructions (drop the invalid scope prefix) so that even casual users
                  > are able to fix their beloved decades-old plugin that has long been
                  > abandoned by its original author.

                  Yeah, the help could mention that this changed at some point and that
                  the function needs to be renamed now.

                  --
                  From "know your smileys":
                  (:-# Said something he shouldn't have

                  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                  /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                  \\\ an exciting new programming language -- http://www.Zimbu.org ///
                  \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

                  ---
                  You received this message because you are subscribed to the Google Groups "vim_dev" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                  For more options, visit https://groups.google.com/d/optout.
                • Bram Moolenaar
                  ... These might be the result of another error, causing the variables not being set. ... Clearly these function names starting with vdebug: are illegal. Did
                  Message 8 of 22 , Apr 24, 2014
                  • 0 Attachment
                    Matteo Cavalleri wrote:

                    > > > Patch 7.4.264 (after 7.4.260)
                    > > > Problem: Can't define a function starting with "g:". Can't assign a
                    > > > funcref to a buffer-local variable.
                    > > > Solution: Skip "g:" at the start of a function name. Don't check for colons
                    > > > when assigning to a variable.
                    > I'm still having problems:
                    >
                    > line 17:
                    > E121: Undefined variable: g:vundle_last_status
                    > E15: Invalid expression: 'updated' == g:vundle_last_status && empty(msg)
                    > Error detected while processing function vundle#installer#new..<SNR>106_process.
                    > .vundle#installer#run..vundle#installer#install..<SNR>106_sync:
                    > line 6:
                    > E117: Unknown function: g:shellesc_cd
                    > E15: Invalid expression: g:shellesc_cd(cmd)
                    > Error detected while processing function vundle#installer#new..<SNR>106_process:
                    >
                    > line 13:
                    > E121: Undefined variable: g:vundle_last_status
                    > E15: Invalid expression: 'error' == g:vundle_last_status
                    > line 17:
                    > E121: Undefined variable: g:vundle_last_status
                    > E15: Invalid expression: 'updated' == g:vundle_last_status && empty(msg)
                    > Error detected while processing function vundle#installer#new..<SNR>106_process.
                    > .vundle#installer#run..vundle#installer#install..<SNR>106_sync:
                    > line 6:
                    > E117: Unknown function: g:shellesc_cd
                    > E15: Invalid expression: g:shellesc_cd(cmd)
                    > Error detected while processing function vundle#installer#new..<SNR>106_process:
                    >
                    > line 13:
                    > E121: Undefined variable: g:vundle_last_status
                    > E15: Invalid expression: 'error' == g:vundle_last_status

                    These might be the result of another error, causing the variables not
                    being set.

                    > the following looks more like it's the script author fault, but I'm not sure if all the errors are due to the illegal function name or not, so I'm pasting them all:
                    >
                    >
                    > Error detected while processing /Users/matteo/.vim/bundle/vdebug/plugin/vdebug.vim:
                    > line 151:
                    > E128: Function name must start with a capital or "s:": vdebug:get_visual_selection()
                    > line 155:
                    > E684: list index out of range: -1
                    > E15: Invalid expression: lines[-1][: col2 - 1]
                    > line 156:
                    > E684: list index out of range: 0
                    > E15: Invalid expression: lines[0][col1 - 1:]
                    > line 157:
                    > E133: :return not inside a function
                    > line 158:
                    > E193: :endfunction not inside a function
                    > line 160:
                    > E128: Function name must start with a capital or "s:": vdebug:edit(filename)
                    > line 162:
                    > E121: Undefined variable: a:filename
                    > E116: Invalid arguments for function fnameescape(a:filename)
                    > E15: Invalid expression: fnameescape(a:filename)
                    > Press ENTER or type command to continue

                    Clearly these function names starting with "vdebug:" are illegal.
                    Did Jon Cairns write this? Perhaps you can contact him.

                    --
                    Warning label on a superhero Halloween costume:
                    "Caution: Cape does not enable user to fly."

                    /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                    /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                    \\\ an exciting new programming language -- http://www.Zimbu.org ///
                    \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

                    ---
                    You received this message because you are subscribed to the Google Groups "vim_dev" group.
                    To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                    For more options, visit https://groups.google.com/d/optout.
                  • Matteo Cavalleri
                    ... I ve never had any problems before patch 260. since there was a discussion going on that patch, I reported those error as I think my (very) little
                    Message 9 of 22 , Apr 24, 2014
                    • 0 Attachment
                      > > E121: Undefined variable: g:vundle_last_status
                      > > E15: Invalid expression: 'error' == g:vundle_last_status
                      >
                      > These might be the result of another error, causing the variables not
                      > being set.

                      I've never had any problems before patch 260. since there was a discussion going on that patch, I reported those error as I think my (very) little knowledge of vimscript isn't enough to debug this problem.
                      I might give it a try if I find some spare time, but in the meanwhile I thought that reporting those errors could still be useful


                      > > the following looks more like it's the script author fault, but I'm not sure if all the errors are due to the illegal function name or not, so I'm pasting them all:
                      >
                      >
                      > Clearly these function names starting with "vdebug:" are illegal.

                      yep, but as I said I wasn't sure if all the following errors were due to that or there was some other change/side effect I wan't aware of.


                      > Did Jon Cairns write this? Perhaps you can contact him.

                      I'll open an issue on github

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

                      ---
                      You received this message because you are subscribed to the Google Groups "vim_dev" group.
                      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                      For more options, visit https://groups.google.com/d/optout.
                    • Alex Efros
                      Hi! ... So, what is the right way to implement this, compatible with pre-patch-260 and current one? I wanna use global variable to define user-configurable
                      Message 10 of 22 , Apr 24, 2014
                      • 0 Attachment
                        Hi!

                        On Thu, Apr 24, 2014 at 12:43:01PM +0200, Bram Moolenaar wrote:
                        > > Me, too. The following used to work:
                        > >
                        > > fun! Foo()
                        > > endfun
                        > > let g:Foo = function('Foo')
                        > >
                        > > After 7.4.264, I get:
                        > > " E705: Variable name conflicts with existing function: g:Foo
                        >
                        > That is correct. Previously Foo() and g:Foo were different names, which
                        > is wrong. Both refer to the same function.

                        So, what is the right way to implement this, compatible with pre-patch-260
                        and current one? I wanna use global variable to define user-configurable
                        handler function, and I've in my plugin code exactly as shown above.
                        My plugin uses exists() and type() for testing value of that global
                        variable, and they return different results for g:Foo in cases
                        fun g:Foo()
                        endfun
                        and
                        fun Foo()
                        endfun
                        let g:Foo = function('Foo')
                        That's why such let operation was added.

                        My guess right solution should be
                        fun s:Foo()
                        endfun
                        let g:Foo = function('s:Foo')
                        but I'm not 100% sure.

                        Also in my plugin I allow users to use symbolic funcref for their custom
                        handlers:
                        fun MyHandler()
                        endfun
                        let g:Handler = 'MyHandler'
                        by using type() to detect is variable contains text and then converting it
                        to real funcref using exists('*MyHandler') and then function('MyHandler) -
                        is this logic still correct after patch 265? Real code is here:
                        https://code.google.com/p/vim-plugin-viewdoc/source/browse/plugin/viewdoc.vim#181


                        P.S. One more difference between fun g:Foo and let g:Foo=function() is
                        while auto-complete 'Foo<Tab>' in command line - first case shown as
                        'Foo(', second as 'Foo' - maybe it makes sense to detect variables with
                        funcref values and show them with '(' in autocomplete too?

                        --
                        WBR, Alex.

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

                        ---
                        You received this message because you are subscribed to the Google Groups "vim_dev" group.
                        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                        For more options, visit https://groups.google.com/d/optout.
                      • Bram Moolenaar
                        ... That should be the right way. The more things are script-local the better. But check that it actually works. ... -- You can t have everything. Where
                        Message 11 of 22 , Apr 25, 2014
                        • 0 Attachment
                          Alex Efros wrote:

                          > On Thu, Apr 24, 2014 at 12:43:01PM +0200, Bram Moolenaar wrote:
                          > > > Me, too. The following used to work:
                          > > >
                          > > > fun! Foo()
                          > > > endfun
                          > > > let g:Foo = function('Foo')
                          > > >
                          > > > After 7.4.264, I get:
                          > > > " E705: Variable name conflicts with existing function: g:Foo
                          > >
                          > > That is correct. Previously Foo() and g:Foo were different names, which
                          > > is wrong. Both refer to the same function.
                          >
                          > So, what is the right way to implement this, compatible with pre-patch-260
                          > and current one? I wanna use global variable to define user-configurable
                          > handler function, and I've in my plugin code exactly as shown above.
                          > My plugin uses exists() and type() for testing value of that global
                          > variable, and they return different results for g:Foo in cases
                          > fun g:Foo()
                          > endfun
                          > and
                          > fun Foo()
                          > endfun
                          > let g:Foo = function('Foo')
                          > That's why such let operation was added.
                          >
                          > My guess right solution should be
                          > fun s:Foo()
                          > endfun
                          > let g:Foo = function('s:Foo')
                          > but I'm not 100% sure.

                          That should be the right way. The more things are script-local the
                          better. But check that it actually works.

                          > Also in my plugin I allow users to use symbolic funcref for their custom
                          > handlers:
                          > fun MyHandler()
                          > endfun
                          > let g:Handler = 'MyHandler'
                          > by using type() to detect is variable contains text and then converting it
                          > to real funcref using exists('*MyHandler') and then function('MyHandler) -
                          > is this logic still correct after patch 265? Real code is here:
                          > https://code.google.com/p/vim-plugin-viewdoc/source/browse/plugin/viewdoc.vim#181
                          >
                          >
                          > P.S. One more difference between fun g:Foo and let g:Foo=function() is
                          > while auto-complete 'Foo<Tab>' in command line - first case shown as
                          > 'Foo(', second as 'Foo' - maybe it makes sense to detect variables with
                          > funcref values and show them with '(' in autocomplete too?

                          --
                          You can't have everything. Where would you put it?
                          -- Steven Wright

                          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                          /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                          \\\ an exciting new programming language -- http://www.Zimbu.org ///
                          \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

                          ---
                          You received this message because you are subscribed to the Google Groups "vim_dev" group.
                          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                          For more options, visit https://groups.google.com/d/optout.
                        • Alex Efros
                          Hi! ... One thing will break in my code because of this change: exists( *Foo ) now return false. Is this correct behaviour in case g:Foo contains Funcref? --
                          Message 12 of 22 , Apr 25, 2014
                          • 0 Attachment
                            Hi!

                            On Fri, Apr 25, 2014 at 03:27:40PM +0200, Bram Moolenaar wrote:
                            > > My guess right solution should be
                            > > fun s:Foo()
                            > > endfun
                            > > let g:Foo = function('s:Foo')
                            > > but I'm not 100% sure.
                            >
                            > That should be the right way. The more things are script-local the
                            > better. But check that it actually works.

                            One thing will break in my code because of this change: exists('*Foo') now
                            return false. Is this correct behaviour in case g:Foo contains Funcref?

                            --
                            WBR, Alex.

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

                            ---
                            You received this message because you are subscribed to the Google Groups "vim_dev" group.
                            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                            For more options, visit https://groups.google.com/d/optout.
                          • Bram Moolenaar
                            ... Previously it was finding the global Foo() function. Now it is script-local, and the global Foo variable is not a function but a Funcref variable. -- From
                            Message 13 of 22 , Apr 25, 2014
                            • 0 Attachment
                              Alex Efros wrote:

                              > On Fri, Apr 25, 2014 at 03:27:40PM +0200, Bram Moolenaar wrote:
                              > > > My guess right solution should be
                              > > > fun s:Foo()
                              > > > endfun
                              > > > let g:Foo = function('s:Foo')
                              > > > but I'm not 100% sure.
                              > >
                              > > That should be the right way. The more things are script-local the
                              > > better. But check that it actually works.
                              >
                              > One thing will break in my code because of this change: exists('*Foo') now
                              > return false. Is this correct behaviour in case g:Foo contains Funcref?

                              Previously it was finding the global Foo() function. Now it is
                              script-local, and the global Foo variable is not a function but a
                              Funcref variable.

                              --
                              From "know your smileys":
                              (X0||) Double hamburger with lettuce and tomato

                              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                              /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                              \\\ an exciting new programming language -- http://www.Zimbu.org ///
                              \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

                              ---
                              You received this message because you are subscribed to the Google Groups "vim_dev" group.
                              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                              For more options, visit https://groups.google.com/d/optout.
                            • Nikolay Pavlov
                              ... now ... Using exists( * ) for testing funcrefs is a better replacement for type() comparison in a number of cases because the fact that you received a
                              Message 14 of 22 , Apr 25, 2014
                              • 0 Attachment


                                On Apr 25, 2014 6:22 PM, "Bram Moolenaar" <Bram@...> wrote:
                                >
                                >
                                > Alex Efros wrote:
                                >
                                > > On Fri, Apr 25, 2014 at 03:27:40PM +0200, Bram Moolenaar wrote:
                                > > > > My guess right solution should be
                                > > > >     fun s:Foo()
                                > > > >     endfun
                                > > > >     let g:Foo = function('s:Foo')
                                > > > > but I'm not 100% sure.
                                > > >
                                > > > That should be the right way.  The more things are script-local the
                                > > > better.  But check that it actually works.
                                > >
                                > > One thing will break in my code because of this change: exists('*Foo') now
                                > > return false. Is this correct behaviour in case g:Foo contains Funcref?
                                >
                                > Previously it was finding the global Foo() function.  Now it is
                                > script-local, and the global Foo variable is not a function but a
                                > Funcref variable.

                                Using exists('*') for testing funcrefs is a better replacement for type() comparison in a number of cases because the fact that you received a funcref never means you can call it, but using exists('*') does. It is very bad idea to break this.

                                >
                                > --
                                > From "know your smileys":
                                >  (X0||)   Double hamburger with lettuce and tomato
                                >
                                >  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net   \\\
                                > ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                > \\\  an exciting new programming language -- http://www.Zimbu.org        ///
                                >  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
                                >
                                > --
                                > --
                                > 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
                                >
                                > ---
                                > You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                > To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                > For more options, visit https://groups.google.com/d/optout.

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

                                ---
                                You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                For more options, visit https://groups.google.com/d/optout.
                              • Nikolay Pavlov
                                ... As long as you care about backward compatibility it is not the right one: previously g:Foo was calling s:Foo, now it will call 123_Foo. You will see
                                Message 15 of 22 , Apr 25, 2014
                                • 0 Attachment


                                  On Apr 25, 2014 2:52 AM, "Alex Efros" <powerman@...> wrote:
                                  >
                                  > Hi!
                                  >
                                  > On Thu, Apr 24, 2014 at 12:43:01PM +0200, Bram Moolenaar wrote:
                                  > > > Me, too. The following used to work:
                                  > > >
                                  > > >     fun! Foo()
                                  > > >     endfun
                                  > > >     let g:Foo = function('Foo')
                                  > > >
                                  > > > After 7.4.264, I get:
                                  > > > " E705: Variable name conflicts with existing function: g:Foo
                                  > >
                                  > > That is correct.  Previously Foo() and g:Foo were different names, which
                                  > > is wrong.  Both refer to the same function.
                                  >
                                  > So, what is the right way to implement this, compatible with pre-patch-260
                                  > and current one? I wanna use global variable to define user-configurable
                                  > handler function, and I've in my plugin code exactly as shown above.
                                  > My plugin uses exists() and type() for testing value of that global
                                  > variable, and they return different results for g:Foo in cases
                                  >     fun g:Foo()
                                  >     endfun
                                  > and
                                  >     fun Foo()
                                  >     endfun
                                  >     let g:Foo = function('Foo')
                                  > That's why such let operation was added.
                                  >
                                  > My guess right solution should be
                                  >     fun s:Foo()
                                  >     endfun
                                  >     let g:Foo = function('s:Foo')
                                  > but I'm not 100% sure.

                                  As long as you care about backward compatibility it is not the right one: previously g:Foo was calling s:Foo, now it will call <SNR>123_Foo. You will see the difference once you try to call g:Foo() from command mode or any file that is not the one where you defined s:Foo.

                                  >
                                  > Also in my plugin I allow users to use symbolic funcref for their custom
                                  > handlers:
                                  >     fun MyHandler()
                                  >     endfun
                                  >     let g:Handler = 'MyHandler'
                                  > by using type() to detect is variable contains text and then converting it
                                  > to real funcref using exists('*MyHandler') and then function('MyHandler) -
                                  > is this logic still correct after patch 265? Real code is here:
                                  > https://code.google.com/p/vim-plugin-viewdoc/source/browse/plugin/viewdoc.vim#181
                                  >
                                  >
                                  > P.S. One more difference between fun g:Foo and let g:Foo=function() is
                                  > while auto-complete 'Foo<Tab>' in command line - first case shown as
                                  > 'Foo(', second as 'Foo' - maybe it makes sense to detect variables with
                                  > funcref values and show them with '(' in autocomplete too?
                                  >
                                  > --
                                  >                         WBR, Alex.
                                  >
                                  > --
                                  > --
                                  > 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
                                  >
                                  > ---
                                  > You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                  > To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                  > For more options, visit https://groups.google.com/d/optout.

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

                                  ---
                                  You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                  For more options, visit https://groups.google.com/d/optout.
                                • Alex Efros
                                  Hi! ... Why is that? -- WBR, Alex. -- -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you are
                                  Message 16 of 22 , Apr 25, 2014
                                  • 0 Attachment
                                    Hi!

                                    On Fri, Apr 25, 2014 at 07:34:16PM +0400, Nikolay Pavlov wrote:
                                    > because the fact that you received a funcref never means you can call it

                                    Why is that?

                                    --
                                    WBR, Alex.

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

                                    ---
                                    You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                    To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                    For more options, visit https://groups.google.com/d/optout.
                                  • Nikolay Pavlov
                                    ... Funcref is a mere string. There is no guarantee that referenced function is defined: one may have used :delfunction. My extended-funcref branch changes
                                    Message 17 of 22 , Apr 25, 2014
                                    • 0 Attachment


                                      On Apr 25, 2014 7:40 PM, "Alex Efros" <powerman@...> wrote:
                                      >
                                      > Hi!
                                      >
                                      > On Fri, Apr 25, 2014 at 07:34:16PM +0400, Nikolay Pavlov wrote:
                                      > > because the fact that you received a funcref never means you can call it
                                      >
                                      > Why is that?

                                      Funcref is a mere string. There is no guarantee that referenced function is defined: one may have used :delfunction. My extended-funcref branch changes this.

                                      >
                                      > --
                                      >                         WBR, Alex.
                                      >
                                      > --
                                      > --
                                      > 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
                                      >
                                      > ---
                                      > You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                      > To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                      > For more options, visit https://groups.google.com/d/optout.

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

                                      ---
                                      You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                      For more options, visit https://groups.google.com/d/optout.
                                    • Bram Moolenaar
                                      ... Not sure what you are saying here, exists( *var ) never worked for when var is a Funcref. You can do it this way: exists( * . string(var)). -- ... ///
                                      Message 18 of 22 , Apr 25, 2014
                                      • 0 Attachment
                                        Nikolay Pavlov wrote:

                                        > On Apr 25, 2014 6:22 PM, "Bram Moolenaar" <Bram@...> wrote:
                                        > >
                                        > > Alex Efros wrote:
                                        > >
                                        > > > On Fri, Apr 25, 2014 at 03:27:40PM +0200, Bram Moolenaar wrote:
                                        > > > > > My guess right solution should be
                                        > > > > > fun s:Foo()
                                        > > > > > endfun
                                        > > > > > let g:Foo = function('s:Foo')
                                        > > > > > but I'm not 100% sure.
                                        > > > >
                                        > > > > That should be the right way. The more things are script-local the
                                        > > > > better. But check that it actually works.
                                        > > >
                                        > > > One thing will break in my code because of this change: exists('*Foo') now
                                        > > > return false. Is this correct behaviour in case g:Foo contains Funcref?
                                        > >
                                        > > Previously it was finding the global Foo() function. Now it is
                                        > > script-local, and the global Foo variable is not a function but a
                                        > > Funcref variable.
                                        >
                                        > Using exists('*') for testing funcrefs is a better replacement for type()
                                        > comparison in a number of cases because the fact that you received a
                                        > funcref never means you can call it, but using exists('*') does. It is very
                                        > bad idea to break this.

                                        Not sure what you are saying here, exists('*var') never worked for when
                                        var is a Funcref. You can do it this way: exists('*' . string(var)).


                                        --
                                        From "know your smileys":
                                        :-X My lips are sealed

                                        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                                        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                        \\\ an exciting new programming language -- http://www.Zimbu.org ///
                                        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

                                        ---
                                        You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                        For more options, visit https://groups.google.com/d/optout.
                                      • Alex Efros
                                        Hi! ... User of my plugin just reported this doesn t work on vim-7.3. I ve checked, and looks like 7.3.1214 works ok, but on 7.3.762 it fails. In 7.3.762
                                        Message 19 of 22 , May 16, 2014
                                        • 0 Attachment
                                          Hi!

                                          On Fri, Apr 25, 2014 at 03:27:40PM +0200, Bram Moolenaar wrote:
                                          > > My guess right solution should be
                                          > > fun s:Foo()
                                          > > endfun
                                          > > let g:Foo = function('s:Foo')
                                          > > but I'm not 100% sure.
                                          >
                                          > That should be the right way. The more things are script-local the
                                          > better. But check that it actually works.

                                          User of my plugin just reported this doesn't work on vim-7.3.
                                          I've checked, and looks like 7.3.1214 works ok, but on 7.3.762 it fails.
                                          In 7.3.762 function('s:Foo') return 's:Foo' instead of '<SNR>42_Foo'.
                                          Is there a way to make this change compatible with old 7.3.x?

                                          --
                                          WBR, Alex.

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

                                          ---
                                          You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                          For more options, visit https://groups.google.com/d/optout.
                                        • Nikolay Pavlov
                                          ... This change has nothing to do with the change that made function( s:... ) work outside of the plugin which defined this funcref. It was a bug that got
                                          Message 20 of 22 , May 16, 2014
                                          • 0 Attachment


                                            On May 16, 2014 12:29 PM, "Alex Efros" <powerman@...> wrote:
                                            >
                                            > Hi!
                                            >
                                            > On Fri, Apr 25, 2014 at 03:27:40PM +0200, Bram Moolenaar wrote:
                                            > > > My guess right solution should be
                                            > > >     fun s:Foo()
                                            > > >     endfun
                                            > > >     let g:Foo = function('s:Foo')
                                            > > > but I'm not 100% sure.
                                            > >
                                            > > That should be the right way.  The more things are script-local the
                                            > > better.  But check that it actually works.
                                            >
                                            > User of my plugin just reported this doesn't work on vim-7.3.
                                            > I've checked, and looks like 7.3.1214 works ok, but on 7.3.762 it fails.
                                            > In 7.3.762 function('s:Foo') return 's:Foo' instead of '<SNR>42_Foo'.
                                            > Is there a way to make this change compatible with old 7.3.x?

                                            This change has nothing to do with the change that made function('s:...') work outside of the plugin which defined this funcref. It was a bug that got fixed. To workaround it on old vims you should use manually replace s: with <SNR>N_ when defining funcrefs. AFAIR :h <SID> shows some ways to get N.

                                            > --
                                            >                         WBR, Alex.
                                            >
                                            > --
                                            > --
                                            > 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
                                            >
                                            > ---
                                            > You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                            > To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                            > For more options, visit https://groups.google.com/d/optout.

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

                                            ---
                                            You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                            For more options, visit https://groups.google.com/d/optout.
                                          • Alex Efros
                                            Hi! ... User reported it on Ubuntu 12.04 LTS with Vim 7.3.429-2ubuntu2.1, I see it on 7.3.762 - so, this bug exists in so many vim versions? ... You mean I
                                            Message 21 of 22 , May 16, 2014
                                            • 0 Attachment
                                              Hi!

                                              On Fri, May 16, 2014 at 12:53:17PM +0400, Nikolay Pavlov wrote:
                                              > On May 16, 2014 12:29 PM, "Alex Efros" <powerman@...> wrote:
                                              > > > > fun s:Foo()
                                              > > > > endfun
                                              > > > > let g:Foo = function('s:Foo')
                                              > This change has nothing to do with the change that made function('s:...')
                                              > work outside of the plugin which defined this funcref. It was a bug that
                                              > got fixed.

                                              User reported it on Ubuntu 12.04 LTS with Vim 7.3.429-2ubuntu2.1, I see it
                                              on 7.3.762 - so, this bug exists in so many vim versions?

                                              > To workaround it on old vims you should use manually replace s: with
                                              > <SNR>N_ when defining funcrefs. AFAIR :h <SID> shows some ways to get N.

                                              You mean I should add

                                              function s:SID()
                                              return matchstr(expand('<sfile>'), '\zs<SNR>\d\+_\zeSID$')
                                              endfunction

                                              into each file of my plugin (it uses sort of sub-plugins in separate
                                              files, so there a lot of them), and then replace in each file each

                                              let g:Foo = function('s:Foo')

                                              with

                                              let g:Foo = function(s:SID().'Foo')

                                              And this is only way to keep compatibility with these vim versions?

                                              --
                                              WBR, Alex.

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

                                              ---
                                              You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                              For more options, visit https://groups.google.com/d/optout.
                                            • Nikolay Pavlov
                                              ... function( s:... ) ... It existed since the time when function() was introduced. Until I wrote a patch that expanded s: when defining funcrefs nobody seemed
                                              Message 22 of 22 , May 16, 2014
                                              • 0 Attachment


                                                On May 16, 2014 1:58 PM, "Alex Efros" <powerman@...> wrote:
                                                >
                                                > Hi!
                                                >
                                                > On Fri, May 16, 2014 at 12:53:17PM +0400, Nikolay Pavlov wrote:
                                                > > On May 16, 2014 12:29 PM, "Alex Efros" <powerman@...> wrote:
                                                > > > > >     fun s:Foo()
                                                > > > > >     endfun
                                                > > > > >     let g:Foo = function('s:Foo')
                                                > > This change has nothing to do with the change that made function('s:...')
                                                > > work outside of the plugin which defined this funcref. It was a bug that
                                                > > got fixed.
                                                >
                                                > User reported it on Ubuntu 12.04 LTS with Vim 7.3.429-2ubuntu2.1, I see it
                                                > on 7.3.762 - so, this bug exists in so many vim versions?

                                                It existed since the time when function() was introduced. Until I wrote a patch that expanded s: when defining funcrefs nobody seemed to be bothered with the fact that you cannot call s: funcrefs outside of the plugin which defined them.

                                                >
                                                > > To workaround it on old vims you should use manually replace s: with
                                                > > <SNR>N_ when defining funcrefs. AFAIR :h <SID> shows some ways to get N.
                                                >
                                                > You mean I should add
                                                >
                                                >     function s:SID()
                                                >             return matchstr(expand('<sfile>'), '\zs<SNR>\d\+_\zeSID$')
                                                >     endfunction
                                                >
                                                > into each file of my plugin (it uses sort of sub-plugins in separate
                                                > files, so there a lot of them), and then replace in each file each
                                                >
                                                >     let g:Foo = function('s:Foo')
                                                >
                                                > with
                                                >
                                                >     let g:Foo = function(s:SID().'Foo')
                                                >
                                                > And this is only way to keep compatibility with these vim versions?

                                                I would recommend switching to anonymous functions if you do not like this variant. There are no other ways I know about.

                                                Anonymous functions:

                                                    let s:F = {}
                                                    function s:F.foo()
                                                    endfunction
                                                    let g:Foo = s:F.foo

                                                . But this has one problem: anonymous functions cannot be called without a dictionary. So to call g:Foo you will either need to always use 3-argument form of call() or define g:FooDict with 'foo' key and call using g:FooDict.foo().

                                                >
                                                > --
                                                >                         WBR, Alex.
                                                >
                                                > --
                                                > --
                                                > 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
                                                >
                                                > ---
                                                > You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                                > To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                                > For more options, visit https://groups.google.com/d/optout.

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

                                                ---
                                                You received this message because you are subscribed to the Google Groups "vim_dev" group.
                                                To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                                                For more options, visit https://groups.google.com/d/optout.
                                              Your message has been successfully submitted and would be delivered to recipients shortly.