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

Re: setloclist() doesn't work

Expand Messages
  • sinbad
    ... does anyone know of this problem, or i am using it in a wrong way. can anyone try this out and let me know. btw, i am running vim 7.0 version. -- You
    Message 1 of 6 , Oct 3, 2011
    • 0 Attachment
      On Sep 30, 10:07 pm, sinbad <sinbad.sin...@...> wrote:
      > On Sep 30, 8:34 pm, Tony Mechelynck <antoine.mechely...@...>
      > wrote:
      >
      >
      >
      >
      >
      >
      >
      >
      >
      > > On 30/09/11 08:44, sinbad wrote:
      >
      > > > hi,
      >
      > > > i am trying to store the contents of location list, so as to use
      > > > multiple location lists for the same split-window window.
      > > > here is what i did. created a location list for some pattern.
      > > > now i ran the following commands in vi.
      >
      > > I hope you mean Vim, and in 'nocompatible' mode. Legacy vi has no
      > > quickfix capabilities.
      >
      > > > :let x= getloclist(0)
      > > > :call setloclist(0, x, 'r')
      >
      > > > location-list is screwed up, i can see some contents in the location
      > > > list
      > > > with filename missing. is it the rightway of using get/setloclist()
      > > > functions.
      >
      > > > thanks
      >
      > > Does it work if you omit the ,'r' (last argument of setloclist())?
      >
      > > Best regards,
      > > Tony.
      > > --
      > > Do what comes naturally now.  Seethe and fume and throw a tantrum.
      >
      > I tried that, it doesn't work too. when i print the stored list 'x' it
      > seems to have
      > all the values properly. but after i use setloclist(0,x) and open the
      > location list
      > the valid bit is set to '0'. i am not sure if i am using it wrongly or
      > if there is a
      > bug in the setloclist() function.

      does anyone know of this problem, or i am using it in a wrong way.
      can anyone try this out and let me know. btw, i am running vim 7.0
      version.

      --
      You received this message from the "vim_use" 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
    • sinbad
      ... I tried in vim 7.3, it is not working in version 7.3 as well. -- You received this message from the vim_use maillist. Do not top-post! Type your reply
      Message 2 of 6 , Oct 4, 2011
      • 0 Attachment
        On Oct 3, 6:26 pm, sinbad <sinbad.sin...@...> wrote:
        > On Sep 30, 10:07 pm, sinbad <sinbad.sin...@...> wrote:
        >
        >
        >
        >
        >
        >
        >
        >
        >
        > > On Sep 30, 8:34 pm, Tony Mechelynck <antoine.mechely...@...>
        > > wrote:
        >
        > > > On 30/09/11 08:44, sinbad wrote:
        >
        > > > > hi,
        >
        > > > > i am trying to store the contents of location list, so as to use
        > > > > multiple location lists for the same split-window window.
        > > > > here is what i did. created a location list for some pattern.
        > > > > now i ran the following commands in vi.
        >
        > > > I hope you mean Vim, and in 'nocompatible' mode. Legacy vi has no
        > > > quickfix capabilities.
        >
        > > > > :let x= getloclist(0)
        > > > > :call setloclist(0, x, 'r')
        >
        > > > > location-list is screwed up, i can see some contents in the location
        > > > > list
        > > > > with filename missing. is it the rightway of using get/setloclist()
        > > > > functions.
        >
        > > > > thanks
        >
        > > > Does it work if you omit the ,'r' (last argument of setloclist())?
        >
        > > > Best regards,
        > > > Tony.
        > > > --
        > > > Do what comes naturally now.  Seethe and fume and throw a tantrum.
        >
        > > I tried that, it doesn't work too. when i print the stored list 'x' it
        > > seems to have
        > > all the values properly. but after i use setloclist(0,x) and open the
        > > location list
        > > the valid bit is set to '0'. i am not sure if i am using it wrongly or
        > > if there is a
        > > bug in the setloclist() function.
        >
        > does anyone know of this problem, or i am using it in a wrong way.
        > can anyone try this out and let me know. btw, i am running vim 7.0
        > version.

        I tried in vim 7.3, it is not working in version 7.3 as well.

        --
        You received this message from the "vim_use" 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
        ... The bufnr is set to 0 when the number used is invalid. That means the buffer must have been wiped out. I can t think of another reason. --
        Message 3 of 6 , Oct 12, 2011
        • 0 Attachment
          Christian Brabandt wrote:

          > CC-ing vim-dev
          >
          > On Tue, October 11, 2011 10:01 am, sinbad wrote:
          > > On Oct 11, 11:07 am, Christian Brabandt <cbli...@...> wrote:
          > >>
          > >> Thanks for the detailed steps. Next time, please attach the plugin, so I
          > >> don't have to fix all the linebreaks ;)
          > >>
          > >> Unfortunately, I can't reproduce the error. I even tried with a stock
          > >> 7.3 vim version. Anyway, I noticed, that all your bufnr are always zero.
          > >> I think that definitely shouldn't be. I guess, somehow all your buffers
          > >> get wiped out. Check with :ls! if there are other buffers available. And
          > >> can you please try this also when starting vim this way:
          > >> vim -u NONE -U NONE -N -i NONE
          > >> then do :so ~/.vim/plugin/gtags.vim
          > >> and proceed as above.
          > >
          > > Thanks for Checking out.
          > > I am still able to reproduce the problem.
          > > I am not sure why it is not happening in your test.
          > > I guess i am all alone in this :(
          > >
          > > vim -u NONE -U NONE -N -i NONE
          > >
          > > :ver
          > > VIM - Vi IMproved 7.0 (2006 May 7, compiled Jun 12 2009 07:08:36)
          > > Included patches: 1, 3-4, 7-9, 11, 13-17, 19-26, 29-31, 34-44, 47,
          > > 50-56, 58-64, 66-73, 75, 77-92, 94-107, 109, 202, 234-237
          > > Modified by <bugzilla@...>
          > > Compiled by <bugzilla@...>
          > > Huge version without GUI. Features included (+) or not (-):
          > > +arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset
          > > +cindent -clientserver -clipboard +cmdline_compl +cmdline_hist
          > > +cmdline_info +comments +cryptv +cscope +cursorshape +dialog_con
          > > +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search
          > > +farsi +file_in_path +find_in_path +folding -footer +fork() +gettext -
          > > hangul_input +iconv +insert_expand +jumplist +keymap
          > > +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu
          > > +mksession +modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm -
          > > mouse_jsbterm +mouse_netterm +mouse_xterm +multi_byte
          > > +multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra +perl
          > > +postscript +printer +profile +python +quickfix +reltime +rightleft -
          > > ruby +scrollbind +signs +smartindent -sniff +statusline
          > > -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl
          > > +terminfo +termresponse +textobjects +title -toolbar +user_commands
          > > +vertsplit +virtualedit +visual +visualextra +viminfo
          > > +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -
          > > xim -xsmp -xterm_clipboard -xterm_save
          > >
          > > :so ~/.vim/plugin/gtags.vim
          > > :scriptnames
          > > 1: /home/sinbad/.vim/plugin/gtags.vim
          > >
          > > :e edit.c
          > > :Gtags -r ResetRedobuff
          > >
          > > :lopen
          > > edit.c|404| ResetRedobuff();
          > > edit.c|6436| ResetRedobuff();
          > > misc2.c|1176| ResetRedobuff();
          > > misc2.c|1177| ResetRedobuff();
          > > normal.c|1506| ResetRedobuff();
          > > normal.c|3626| ResetRedobuff();
          > > normal.c|7380| ResetRedobuff();
          > > spell.c|10317| ResetRedobuff();
          > >
          > > :echo getloclist(0)
          > > [{'lnum': 404, 'bufnr': 1, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1,
          > > 'type': '', 'pattern': '', 'text': ' ResetRedobuff();'},
          > > {'lnum': 6436, 'bufnr': 1, 'col': 0, 'valid': 1, 'vcol':
          > > 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '
          > > ResetRedobuff();'}, {'lnum': 1176, 'bufnr': 3, 'col': 0, 'valid': 1,
          > > 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '
          > > ResetRedobuff();'}, {'lnum': 1177, 'bufnr': 3, 'col': 0,
          > > 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text':
          > > ' ResetRedobuff();'}, {'lnum': 1506, 'bufnr': 4, 'col'
          > > : 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '',
          > > 'text': ' ResetRedobuff();'}, {'lnum': 3626,
          > > 'bufnr': 4, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type':
          > > '', 'pattern': '', 'text': ' ResetRedobuff();'}, {'lnum':
          > > 7380, 'bufnr': 4, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type':
          > > '', 'pattern': '', 'text': ' ResetRedobuff();'
          > > }, {'lnum': 10317, 'bufnr': 5, 'col': 0, 'valid': 1, 'vcol': 0, 'nr':
          > > -1, 'type': '', 'pattern': '', 'text': '
          > > ResetRedobuff();'}]
          > >
          > > :let x = getloclist(0)
          > >
          > > :echo x
          > >
          > > [{'lnum': 404, 'bufnr': 1, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1,
          > > 'type': '', 'pattern': '', 'text': ' ResetRedobuff();'},
          > > {'lnum': 6436, 'bufnr': 1, 'col': 0, 'valid': 1, 'vcol':
          > > 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '
          > > ResetRedobuff();'}, {'lnum': 1176, 'bufnr': 3, 'col': 0, 'valid': 1,
          > > 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '
          > > ResetRedobuff();'}, {'lnum': 1177, 'bufnr': 3, 'col': 0,
          > > 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text':
          > > ' ResetRedobuff();'}, {'lnum': 1506, 'bufnr': 4, 'col'
          > > : 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '',
          > > 'text': ' ResetRedobuff();'}, {'lnum': 3626,
          > > 'bufnr': 4, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type':
          > > '', 'pattern': '', 'text': ' ResetRedobuff();'}, {'lnum':
          > > 7380, 'bufnr': 4, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type':
          > > '', 'pattern': '', 'text': ' ResetRedobuff();'
          > > }, {'lnum': 10317, 'bufnr': 5, 'col': 0, 'valid': 1, 'vcol': 0, 'nr':
          > > -1, 'type': '', 'pattern': '', 'text': '
          > > ResetRedobuff();'}]
          > >
          > >
          > > :call setloclist(0,[])
          > > :call setloclist(0, x)
          > >
          > > :lopen " filenames are missing
          > > |404| ResetRedobuff();
          > > |6436| ResetRedobuff();
          > > |1176| ResetRedobuff();
          > > |1177| ResetRedobuff();
          > > |1506| ResetRedobuff();
          > > |3626| ResetRedobuff();
          > > |7380| ResetRedobuff();
          > > |10317| ResetRedobuff();
          > > ~
          > >
          > > :ls!
          > > 1 %a "edit.c" line 404
          > > 2u - "~/vim7.3/vim73/src" line 1
          > > 3u "misc2.c" line 0
          > > 4u "normal.c" line 0
          > > 5u "spell.c" line 0
          > > 7 a- "[Location List]" line 0
          > > 8 # "getchar.c" line 463
          >
          > Can you please output :echo getloclist(0) after you used :call
          > setloclist(0,x)? The question is, why does the 'bufnr' key gets zero.
          > Honestly, I don't have a clue in your case. Just to make sure, you did all
          > this
          > when calling vim using -u NONE -U NONE -N -i NONE and are note using
          > any autocommand like BufUnload or something? Does setting 'hidden' help?
          >
          > BTW: Is there a reason, you are using this old version of vim? Can you
          > please try this with the latest patchlevel of Vim?
          >
          > Bram, can you imagine, why the bufnr could become 0, e.g. all entries get
          > invalid?

          The bufnr is set to 0 when the number used is invalid. That means the
          buffer must have been wiped out. I can't think of another reason.

          --
          hundred-and-one symptoms of being an internet addict:
          59. Your wife says communication is important in a marriage...so you buy
          another computer and install a second phone line so the two of you can
          chat.

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