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

v:oldfiles won't be initialized when vim -u NONE

Expand Messages
  • mattn
    Hi. $ vim ... [ /path/to/oldfile.txt , ....snip....] $ vim -u NONE $ echo v:oldfiles This return empty because VV_OLDFILES isn t initialized with allocated
    Message 1 of 9 , Dec 15, 2013
    • 0 Attachment
      Hi.

      $ vim
      :echo v:oldfiles
      ['/path/to/oldfile.txt', ....snip....]

      $ vim -u NONE
      $ echo v:oldfiles

      This return empty because VV_OLDFILES isn't initialized with allocated list.


      diff -r 7818ca6de3d0 src/main.c
      --- a/src/main.c Wed Dec 11 18:53:29 2013 +0100
      +++ b/src/main.c Mon Dec 16 12:05:52 2013 +0900
      @@ -701,6 +701,10 @@
      read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
      TIME_MSG("reading viminfo");
      }
      +# ifdef FEAT_EVAL
      + if (get_vim_var_list(VV_OLDFILES) == NULL)
      + set_vim_var_list(VV_OLDFILES, list_alloc());
      +# endif
      #endif

      #ifdef FEAT_QUICKFIX

      - Yasuhiro Matsumoto

      --
      --
      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.
    • Tony Mechelynck
      ... Isn t this intentional? With -u NONE, Vim starts in nocompatible mode, thus the default for viminfo is the empty stringà and Vim doesn t use a viminfo
      Message 2 of 9 , Dec 15, 2013
      • 0 Attachment
        On 16/12/13 04:12, mattn wrote:
        > Hi.
        >
        > $ vim
        > :echo v:oldfiles
        > ['/path/to/oldfile.txt', ....snip....]
        >
        > $ vim -u NONE
        > $ echo v:oldfiles
        >
        > This return empty because VV_OLDFILES isn't initialized with allocated list.

        Isn't this intentional? With -u NONE, Vim starts in 'nocompatible' mode,
        thus the default for 'viminfo' is the empty string… and Vim doesn't use
        a viminfo file (doesn't read it on startup and doesn't write it on
        exit). Thus there is no list of oldfiles read from the viminfo.

        Counterexample:

        vim -N -u NONE
        :oldfiles

        (in plain-vanilla Huge Vim 7.4.131) shows that the oldfiles list has
        been populated.

        See :help 'viminfo'

        >
        >
        > diff -r 7818ca6de3d0 src/main.c
        > --- a/src/main.c Wed Dec 11 18:53:29 2013 +0100
        > +++ b/src/main.c Mon Dec 16 12:05:52 2013 +0900
        > @@ -701,6 +701,10 @@
        > read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
        > TIME_MSG("reading viminfo");
        > }
        > +# ifdef FEAT_EVAL
        > + if (get_vim_var_list(VV_OLDFILES) == NULL)
        > + set_vim_var_list(VV_OLDFILES, list_alloc());
        > +# endif
        > #endif
        >
        > #ifdef FEAT_QUICKFIX
        >
        > - Yasuhiro Matsumoto
        >

        Best regards,
        Tony.
        --
        Q: How many Oregonians does it take to screw in a light bulb?
        A: Three. One to screw in the light bulb and two to fend off all those
        Californians trying to share the experience.

        --
        --
        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.
      • Tony Mechelynck
        ... OOps: in compatible mode, of course ... -- Too many of our best scholars, themselves indoctrinated from infancy in a religion of one kind or another
        Message 3 of 9 , Dec 15, 2013
        • 0 Attachment
          On 16/12/13 05:05, Tony Mechelynck wrote:
          > On 16/12/13 04:12, mattn wrote:
          >> Hi.
          >>
          >> $ vim
          >> :echo v:oldfiles
          >> ['/path/to/oldfile.txt', ....snip....]
          >>
          >> $ vim -u NONE
          >> $ echo v:oldfiles
          >>
          >> This return empty because VV_OLDFILES isn't initialized with allocated
          >> list.
          >
          > Isn't this intentional? With -u NONE, Vim starts in 'nocompatible' mode,
          ------------------------------------------------------^
          OOps: in 'compatible' mode, of course

          > thus the default for 'viminfo' is the empty string… and Vim doesn't use
          > a viminfo file (doesn't read it on startup and doesn't write it on
          > exit). Thus there is no list of oldfiles read from the viminfo.
          >
          > Counterexample:
          >
          > vim -N -u NONE
          > :oldfiles
          >
          > (in plain-vanilla Huge Vim 7.4.131) shows that the oldfiles list has
          > been populated.
          >
          > See :help 'viminfo'
          >
          >>
          >>
          >> diff -r 7818ca6de3d0 src/main.c
          >> --- a/src/main.c Wed Dec 11 18:53:29 2013 +0100
          >> +++ b/src/main.c Mon Dec 16 12:05:52 2013 +0900
          >> @@ -701,6 +701,10 @@
          >> read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
          >> TIME_MSG("reading viminfo");
          >> }
          >> +# ifdef FEAT_EVAL
          >> + if (get_vim_var_list(VV_OLDFILES) == NULL)
          >> + set_vim_var_list(VV_OLDFILES, list_alloc());
          >> +# endif
          >> #endif
          >>
          >> #ifdef FEAT_QUICKFIX
          >>
          >> - Yasuhiro Matsumoto
          >>
          >
          > Best regards,
          > Tony.
          --
          "Too many of our best scholars, themselves indoctrinated from infancy in a
          religion of one kind or another based upon the Bible, are so locked into
          the idea of their own god as a supernatural fact - something final, not
          symbolic of transcendence, but a personage with a character and will of
          his own - that they are unable to grasp the idea of a worship that is not
          of the symbol but of its reference, which is of a mystery of much greater
          age and of more immediate inward reality than the name-and-form of any
          historical ethnic idea of a deity, whatsoever...and is of a sophistication
          that makes the sentimentalism of our popular Bible-story theology seem
          undeveloped."
          [Joseph Campbell, American mythologist (1904-1987)]

          --
          --
          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.
        • mattn
          You can use no-compatible mode but you can do :echo v:oldfiles. And it refer NULL pointer. ... -- -- You received this message from the vim_dev maillist. Do
          Message 4 of 9 , Dec 16, 2013
          • 0 Attachment
            You can use no-compatible mode but you can do :echo v:oldfiles.
            And it refer NULL pointer.

            On Monday, December 16, 2013 12:12:12 PM UTC+9, mattn wrote:
            > Hi.
            >
            > $ vim
            > :echo v:oldfiles
            > ['/path/to/oldfile.txt', ....snip....]
            >
            > $ vim -u NONE
            > $ echo v:oldfiles
            >
            > This return empty because VV_OLDFILES isn't initialized with allocated list.
            >
            >
            > diff -r 7818ca6de3d0 src/main.c
            > --- a/src/main.c Wed Dec 11 18:53:29 2013 +0100
            > +++ b/src/main.c Mon Dec 16 12:05:52 2013 +0900
            > @@ -701,6 +701,10 @@
            > read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
            > TIME_MSG("reading viminfo");
            > }
            > +# ifdef FEAT_EVAL
            > + if (get_vim_var_list(VV_OLDFILES) == NULL)
            > + set_vim_var_list(VV_OLDFILES, list_alloc());
            > +# endif
            > #endif
            >
            > #ifdef FEAT_QUICKFIX
            >
            > - Yasuhiro Matsumoto

            --
            --
            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.
          • Tony Mechelynck
            ... When I start Vim (the current Huge version 7.4.131, without applying your patch) with vim -N -u NONE then :echo v:oldfiles gives me a fully populated
            Message 5 of 9 , Dec 16, 2013
            • 0 Attachment
              On 16/12/13 12:33, mattn wrote:
              > You can use no-compatible mode but you can do :echo v:oldfiles.
              > And it refer NULL pointer.
              >

              When I start Vim (the current "Huge" version 7.4.131, without applying
              your patch) with "vim -N -u NONE" then ":echo v:oldfiles" gives me a
              fully populated List of files. ":oldfiles" gives the same results in a
              more human-readable way.

              When I start it with "vim -u NONE", thus in 'compatible' mode, the
              oldfiles list is not populated (and the viminfo not used). I still
              believe that this is intentional. Let's hear what Bram has to say about it.


              Best regards,
              Tony.
              --
              hundred-and-one symptoms of being an internet addict:
              52. You ask a plumber how much it would cost to replace the chair in
              front of
              your computer with a toilet.

              --
              --
              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.
            • mattn
              ... Try: vim -i NONE ... It should show []. -- -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you
              Message 6 of 9 , Dec 16, 2013
              • 0 Attachment
                On Tuesday, December 17, 2013 1:43:20 PM UTC+9, Tony Mechelynck wrote:
                > On 16/12/13 12:33, mattn wrote:
                > > You can use no-compatible mode but you can do :echo v:oldfiles.
                > > And it refer NULL pointer.
                > >
                > When I start Vim (the current "Huge" version 7.4.131, without applying
                > your patch) with "vim -N -u NONE" then ":echo v:oldfiles" gives me a
                > fully populated List of files. ":oldfiles" gives the same results in a
                > more human-readable way.
                > When I start it with "vim -u NONE", thus in 'compatible' mode, the
                > oldfiles list is not populated (and the viminfo not used). I still
                > believe that this is intentional. Let's hear what Bram has to say about it.

                Try:

                vim -i NONE
                :echo oldfiles

                It should show [].

                --
                --
                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.
              • Tony Mechelynck
                ... Hm, for some reason it displays the empty string instead, and ... returns 0, but ... returns 1 and ... returns 0. Also, ... answers with No old files Also
                Message 7 of 9 , Dec 17, 2013
                • 0 Attachment
                  On 17/12/13 08:27, mattn wrote:
                  >
                  > On Tuesday, December 17, 2013 1:43:20 PM UTC+9, Tony Mechelynck wrote:
                  >> On 16/12/13 12:33, mattn wrote:
                  >>> You can use no-compatible mode but you can do :echo v:oldfiles.
                  >>> And it refer NULL pointer.
                  >>>
                  >> When I start Vim (the current "Huge" version 7.4.131, without applying
                  >> your patch) with "vim -N -u NONE" then ":echo v:oldfiles" gives me a
                  >> fully populated List of files. ":oldfiles" gives the same results in a
                  >> more human-readable way.
                  >> When I start it with "vim -u NONE", thus in 'compatible' mode, the
                  >> oldfiles list is not populated (and the viminfo not used). I still
                  >> believe that this is intentional. Let's hear what Bram has to say about it.
                  >
                  > Try:
                  >
                  > vim -i NONE
                  > :echo oldfiles
                  >
                  > It should show [].
                  >

                  Hm, for some reason it displays the empty string instead, and
                  :echo v:oldfiles == []
                  returns 0, but
                  :echo empty(v:oldfiles)
                  returns 1 and
                  :echo len(v:oldfiles)
                  returns 0. Also,
                  :oldfiles
                  answers with
                  No old files
                  Also (to rule out the possibility of an empty value of a different
                  type), I tried the following:
                  :echo type(v:oldfiles)
                  which returns 3, and
                  :echo type(v:oldfiles) == type([])
                  which returns 1.

                  I would have expected the above results, starting at the value of
                  empty(), but the fact that v:oldfiles is empty without being equal to []
                  surprises me. Could it be a NULL pointer or something?

                  I get the same results in
                  vim -u NONE
                  without -N, which is not surprising.


                  Best regards,
                  Tony.
                  --
                  Reactor error - core dumped!

                  --
                  --
                  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.
                • mattn
                  ... Yes, it set v:oldfiles as NULL pointer when vim -i NONE. -- -- You received this message from the vim_dev maillist. Do not top-post! Type your reply
                  Message 8 of 9 , Dec 17, 2013
                  • 0 Attachment
                    > Could it be a NULL pointer or something?

                    Yes, it set v:oldfiles as NULL pointer when vim -i NONE.

                    --
                    --
                    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
                    ... Thanks I ll add it in the todo list. -- Amnesia is one of my favorite words, but I forgot what it means. /// Bram Moolenaar -- Bram@Moolenaar.net --
                    Message 9 of 9 , Jan 6, 2014
                    • 0 Attachment
                      Yasuhiro Matsumoto wrote:

                      > $ vim
                      > :echo v:oldfiles
                      > ['/path/to/oldfile.txt', ....snip....]
                      >
                      > $ vim -u NONE
                      > $ echo v:oldfiles
                      >
                      > This return empty because VV_OLDFILES isn't initialized with allocated list.

                      Thanks I'll add it in the todo list.

                      --
                      Amnesia is one of my favorite words, but I forgot what it means.

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