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

69946Re: [patch] get quickfix stack

Expand Messages
  • Christian Brabandt
    May 21, 2013
    • 0 Attachment
      On Do, 16 Mai 2013, LCD 47 wrote:

      > On 15 May 2013, Christian Brabandt <cblists@...> wrote:
      > > Hi LCD!
      > >
      > > On Mi, 15 Mai 2013, LCD 47 wrote:
      > >
      > > > (1) getqfstack() / getlocstack() should simply return a list of
      > > > loclists;
      > > > (2) there should be a separate function for getting (and perhaps
      > > > another one for setting) the stack pointer in these lists,
      > > > namely a number in range 0 .. len(list)-1;
      > >
      > > Okay. I'll update the patch accordingly.
      >
      > Great, thank you!
      >
      > > > (3) "title" should be an attribute of the individual loclists;
      > >
      > > That doesn't make sense. The getqflist() returns a list of dictionary
      > > items each one describing one error. You can theoretical add an
      > > attribute to each error for the title or even add the title as last
      > > element to the list, but that really is ugly.
      >
      > Right, not like that. What I was thinking of was more along the
      > lines of what Vim does with buffers, windows, tabs, etc.: give them
      > symbolic (non-repeating) numbers, and manipulate them through those
      > numbers. This should work as long as loclists can't exist outside of a
      > stack. Thus:
      >
      > - getlocstack() would return something like [2, 3, 7]
      > - 3 would be the ID of the third loclist created in the current session
      > - locerrors(3) would return the list of dictionary items for loclist 3
      > - locnr(loclist) would return the ID of loclist, say 3
      > - loctitle(3, 'foo') would set the title of loclist 3
      > - loctitle(3) would return the title of loclist 3
      > - locsp(2) would set the index in [2, 3, 7] of the current loclist
      > - locsp() would return the index in [2, 3, 7] of the current loclist.
      >
      > Or, if you prefer, the equivalent getmumble() / setmumble() instead
      > of overloaded functions.
      >
      > > > (4) there should be separate functions for getting and setting the
      > > > title for a given loclist;
      > >
      > > Okay.
      > >
      > > > (5) I'm not sure setqfstack() / setlocstack() would be all that
      > > > useful; instead, I'd rather see lifted (or perhaps made
      > > > configurable) the limit of 10 loclists per stack.
      >
      > The point here is that knowing the location inside the stack etc. is
      > enough only as long as the stack doesn't become full. If there are real
      > chances of the stack filling up, a setlocstack() might be a better
      > solution.
      >
      > > Okay, scratch that. I'll post an updated patch soon.
      >
      > It always pays to get the design right before starting to write the
      > code. Perhaps give it a few days to sink in, then check that it still
      > makes sense...

      Attached is an updated patch. It adds the following functions:

      getlocstack() returns the location list stack as list
      getlocstackptr() returns the current position in the location list stack
      getloctitle() returns a list of titles for the location list stack
      getqfstack() returns the quickfix stack as list
      getqfstackptr() returns the index in the quickfix stack
      getqftitle() returns a list of titles in the quickfix stack
      setlocstackptr() sets the index in the location list stack
      setqfstackptr() sets the index in the quickfix list
      setqftitle() sets the title for the current item in the quickfix list stack
      setloctitle() sets the title for the current item in the location list stack

      regards,
      Christian
      --
      Achtung nutzt sich ab wie Liebe.
      -- Luc de Clapiers Vauvenargues (Reflexionen und Maximen)

      --
      --
      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.
    • Show all 21 messages in this topic