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

76186Re: argisglobal patch

Expand Messages
  • Marcin Szamotulski
    Apr 27, 2014
      On 08:22 Sat 08 Feb , Marcin Szamotulski wrote:
      > On 22:27 Fri 07 Feb , Bram Moolenaar wrote:
      > >
      > > Marcin Szamotulski wrote:
      > >
      > > > > > I wrote a small patch which adds argisglobal() function which returns
      > > > > > 1 if the current buffer has global arglist otherwise, if there is
      > > > > > a local arg list it return 0. I haven't found any other way to test if
      > > > > > the arglist is gobal/local.
      > > > > >
      > > > > > I've been using this patch for some time already (I have a plugin
      > > > > > http://www.vim.org/scripts/script.php?script_id=4681 which is using it)
      > > > > > and it works fine.
      > > > >
      > > > > I'm sure someone will ask for another thing: What local argument list is
      > > > > being used. They can be shared between windows.
      > > > >
      > > > > A more generic solution would be to request the ID of the local argument
      > > > > list. When zero, then the window is using the global argument list.
      > > > >
      > > > > And then we of course also want to optionally pass in the window number.
      > > > > So it would be:
      > > > >
      > > > > arglistid([winnr])
      > > >
      > > > Yes that's much better solution. I have a question though. The alist_T
      > > > structure does not contain an ID of arglist (only list of files, and
      > > > number of windows using it). How should I generate the ID?
      > >
      > > You could use the pointer and turn it into an int, but that's ugly (and
      > > doesn't work if sizeof(int) is smaller than sizeof(char *).
      > >
      > > So the best is to add an ID to alist_T and use a static global to store
      > > the last used ID. That's in alist_new().
      >
      > Thanks. I'll follow your advice.
      >
      > Best regards,
      > Marcin


      Dear Bram,

      I attach the patch for arglistid().


      Best regards,
      Marcin Szamotulski
    • Show all 6 messages in this topic