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

getbufvar(), getwinvar(), gettabvar(), gettabwinvar() cannot set default value

Expand Messages
  • Shougo
    I created the patch for adding default value argument feature. I think this feature is useful to write Vim script. Below is vim script for testing the feature.
    Message 1 of 10 , Dec 26, 2012
    • 0 Attachment
      I created the patch for adding default value argument feature.
      I think this feature is useful to write Vim script.

      Below is vim script for testing the feature.

      -----------------------

      echomsg getbufvar(1, 'foo', 'var')
      echomsg getwinvar(1, 'foo', 'var')
      echomsg gettabvar(1, 'foo', 'var')
      echomsg gettabwinvar(1, 1, 'foo', 'var')

      -----------------------

      If you applied the patch to Vim, you get "var" output.
      I tested the patch in Vim 7.3.762 and it works.

      --
      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
    • Shougo
      ... You can get same behavior using get() hack. But I think the feature is more clealy. ... echomsg get(getbufvar(1, ), foo , var ) ... -- You received
      Message 2 of 10 , Dec 26, 2012
      • 0 Attachment
        2012年12月27日木曜日 13時24分23秒 UTC+9 Shougo:
        > I created the patch for adding default value argument feature.
        > I think this feature is useful to write Vim script.
        >
        > Below is vim script for testing the feature.
        >
        > -----------------------
        >
        > echomsg getbufvar(1, 'foo', 'var')
        > echomsg getwinvar(1, 'foo', 'var')
        > echomsg gettabvar(1, 'foo', 'var')
        > echomsg gettabwinvar(1, 1, 'foo', 'var')
        >
        > -----------------------
        >
        > If you applied the patch to Vim, you get "var" output.
        > I tested the patch in Vim 7.3.762 and it works.

        You can get same behavior using get() hack. But I think the feature is more clealy.

        --------------------------
        echomsg get(getbufvar(1, ""), 'foo', 'var')
        --------------------------

        --
        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
      • Bram Moolenaar
        ... Thanks, this looks useful. Instead of manual testing, it would be useful to have the tests in src/testdir. Vim is getting more and more complex, it s good
        Message 3 of 10 , Dec 29, 2012
        • 0 Attachment
          Shougo Matsu wrote:

          > I created the patch for adding default value argument feature.
          > I think this feature is useful to write Vim script.
          >
          > Below is vim script for testing the feature.
          >
          > -----------------------
          >
          > echomsg getbufvar(1, 'foo', 'var')
          > echomsg getwinvar(1, 'foo', 'var')
          > echomsg gettabvar(1, 'foo', 'var')
          > echomsg gettabwinvar(1, 1, 'foo', 'var')
          >
          > -----------------------
          >
          > If you applied the patch to Vim, you get "var" output.
          > I tested the patch in Vim 7.3.762 and it works.

          Thanks, this looks useful.

          Instead of manual testing, it would be useful to have the tests in
          src/testdir. Vim is getting more and more complex, it's good to test
          every feature.


          --
          hundred-and-one symptoms of being an internet addict:
          207. You're given one phone call in prison and you ask them for a laptop.

          /// 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
        • Shougo
          ... Thank you for the reply. I can add test script but I don t know how to make test script for Vim source code. -- You received this message from the
          Message 4 of 10 , Dec 31, 2012
          • 0 Attachment
            > Thanks, this looks useful.
            >
            >
            >
            > Instead of manual testing, it would be useful to have the tests in
            >
            > src/testdir. Vim is getting more and more complex, it's good to test
            >
            > every feature.
            >
            >
            >

            Thank you for the reply. I can add test script but I don't know how to make test script for Vim source code.

            --
            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
          • ZyX
            ... There are no direct tests for source code (you meant unit tests?). Functional tests are located at src/testdir (where Bram already pointed you).
            Message 5 of 10 , Dec 31, 2012
            • 0 Attachment
              > > Instead of manual testing, it would be useful to have the tests in
              > > src/testdir. Vim is getting more and more complex, it's good to test
              > > every feature.
              >
              > Thank you for the reply. I can add test script but I don't know how to make test script for Vim source code.

              There are no direct tests for source code (you meant unit tests?). Functional tests are located at src/testdir (where Bram already pointed you). “gettabvar()” is already tested in src/testdir/test62.in so it makes sense to put the test for it there. Grep failed to locate all of the other functions in src/testdir so testing for new functionality needs to be combined with testing for old one. No advice for placing, ask Bram or read other tests to find what suits best, maybe the new one.

              You probably don’t need to know how exactly that .in file is called (I constantly forget it), but here is the exact command-line on unix (working directory = src/testdir):

              ../vim -u unix.vim -U NONE --noplugin -s dotest.in test87.in
              . Output is then placed to test.out (Makefile moves it to test87.out afterwards). If you are sure new test works fine just replace old test62.ok with test62.out (make) / test.out (manual launch). Test is considered successful if test.out is identical to test87.ok, that’s all. How exactly test.out is written is determined by the test itself, for disabled features, for example, tests just copy *.ok file to test.out.

              Though all I ever did is just taking an existing test file and modifying it or copying, purging actual tests keeping some test.out-writing code and then adding new ones. You don’t need to “know” anything, just do like somebody did before.

              --
              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
            • h_east
              Hi, Bram, Shougo and list. ... I wrote a test code. and found small bugs. I fixed this. ({def} may set only valid {bufnr}, {winnr}, {tabnr} spcified.)
              Message 6 of 10 , Jan 1, 2013
              • 0 Attachment
                Hi, Bram, Shougo and list.

                2013/1/1(Tue) 13:02:14 UTC+9 Shougo:
                > > Thanks, this looks useful.
                > >
                > >
                > >
                > > Instead of manual testing, it would be useful to have the tests in
                > >
                > > src/testdir. Vim is getting more and more complex, it's good to test
                > >
                > > every feature.
                > >
                > >
                > >
                >
                > Thank you for the reply. I can add test script but I don't know how to make test script for Vim source code.

                I wrote a test code. and found small bugs. I fixed this.
                ({def} may set only valid {bufnr}, {winnr}, {tabnr} spcified.)
                (gettabver(1, '', 'def') and gettabver(1, '&nu', 'def') should not return `def`.)
                Attach a patch. (test89 added and code modified)
                Please check.

                Best regards,
                --
                Hirohito Higashi

                --
                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
              • Shougo
                ... Thank you for your modification. I think it is good. -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the
                Message 7 of 10 , Jan 1, 2013
                • 0 Attachment
                  >
                  > I wrote a test code. and found small bugs. I fixed this.
                  > ({def} may set only valid {bufnr}, {winnr}, {tabnr} spcified.)
                  > (gettabver(1, '', 'def') and gettabver(1, '&nu', 'def') should not return `def`.)
                  > Attach a patch. (test89 added and code modified)
                  > Please check.
                  >
                  > Best regards,
                  > --
                  > Hirohito Higashi

                  Thank you for your modification. I think it is good.

                  --
                  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
                • Bram Moolenaar
                  ... Thanks, I ll add this to the todo list. -- hundred-and-one symptoms of being an internet addict: 225. You sign up for free subscriptions for all the
                  Message 8 of 10 , Jan 2, 2013
                  • 0 Attachment
                    Hirohito Higashi wrote:

                    > Hi, Bram, Shougo and list.
                    >
                    > 2013/1/1(Tue) 13:02:14 UTC+9 Shougo:
                    > > > Thanks, this looks useful.
                    > > >
                    > > > Instead of manual testing, it would be useful to have the tests in
                    > > > src/testdir. Vim is getting more and more complex, it's good to test
                    > > > every feature.
                    > >
                    > > Thank you for the reply. I can add test script but I don't know how
                    > > to make test script for Vim source code.
                    >
                    > I wrote a test code. and found small bugs. I fixed this.
                    > ({def} may set only valid {bufnr}, {winnr}, {tabnr} spcified.)
                    > (gettabver(1, '', 'def') and gettabver(1, '&nu', 'def') should not return `def`.)
                    > Attach a patch. (test89 added and code modified)
                    > Please check.

                    Thanks, I'll add this to the todo list.

                    --
                    hundred-and-one symptoms of being an internet addict:
                    225. You sign up for free subscriptions for all the computer magazines

                    /// 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
                  • h_east
                    Hi Bram ... Thanks for adding todo list. But original patch author is forgotten. todo.txt : 93 Patch to add default value to getbufvar() et al. (Hirohito
                    Message 9 of 10 , Jan 31, 2013
                    • 0 Attachment
                      Hi Bram

                      2013/1/3(Thu) 1:50:25 UTC+9 Bram Moolenaar:
                      > Thanks, I'll add this to the todo list.

                      Thanks for adding todo list.
                      But original patch author is forgotten.

                      todo.txt : 93
                      Patch to add default value to getbufvar() et al. (Hirohito Higashi, 2013 Jan 1)

                      Please fix this as:
                      Patch to add default value to getbufvar() et al. (Shougo Matsushita, Hirohito Higashi, 2013 Jan 1)

                      Best Regards,
                      Hirohito Higashi

                      --
                      --
                      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/groups/opt_out.
                    • Bram Moolenaar
                      ... The todo list has the name of the person who sent the patch. That s how I can find it again. But it s good to have the name of the original patch author,
                      Message 10 of 10 , Jan 31, 2013
                      • 0 Attachment
                        Hirohito Higashi wrote:

                        > 2013/1/3(Thu) 1:50:25 UTC+9 Bram Moolenaar:
                        > > Thanks, I'll add this to the todo list.
                        >
                        > Thanks for adding todo list.
                        > But original patch author is forgotten.
                        >
                        > todo.txt : 93
                        > Patch to add default value to getbufvar() et al. (Hirohito Higashi,
                        > 2013 Jan 1)
                        >
                        > Please fix this as:
                        > Patch to add default value to getbufvar() et al. (Shougo Matsushita,
                        > Hirohito Higashi, 2013 Jan 1)

                        The todo list has the name of the person who sent the patch. That's how
                        I can find it again. But it's good to have the name of the original
                        patch author, I might forget.

                        --
                        There are 10 kinds of people: Those who understand binary and those who don't.

                        /// 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/groups/opt_out.
                      Your message has been successfully submitted and would be delivered to recipients shortly.