Unless I'm mistaken, but when either window is open the only way I could check
which one is open is by using :ls and checking if it reports the name of any
buffer as "[Quickfix List]" or "[Location List]".
I think it would be much easier if function bufname() had a second argument and when it's not zero it would return a special buffer name. Please see the patch attached.
Regards,
Kent
I see. Even though it's quite awkward to add a new function just to accommodate this particular case, i'm attaching my attempt to implement it.
Regards,
Kent.
>
> Wait, isn't the title already supposed to tell you that?
>
What do you mean by title?
Regards,
Kent.
> By default the status line of the quickfix open shows "[Quickfix
> List]" or "[Location List]", followed by the w:quickfix_title variable
> described above. Some of the plugins that customize status lines choose
> to ignore that information. I don't think this is something that needs
> to be fixed in Vim.
That's my point. There is no reliable way to distinguish if we are dealing with
a quickfix or a location window. Considering that you have to use different set of
commands to handle these windows, this information has to be easily obtainable. But
as of right now, it's not the case. w:quickfix_window can be modified, which means it
is not a reliable source.
Also status line uses buf_spname() function that is not exposed via API and as Bram
mentioned returns values that are translated.
Regards,
Kent
2016-8-9(Tue) 6:27:17 UTC+9 Bram Moolenaar:
> Kent Sibilev wrote:
>
> > On Saturday, August 6, 2016 at 1:02:18 PM UTC-4, Bram Moolenaar wrote:
> > >
> > > The problem with this solution is that the names are translated.
> > > A more direct solution would be better.
> > >
> > > The 'buftype' option is "quickfix" for both quickfix and location list.
> > > We can't change that without causing problems.
> > >
> > > Perhaps we should add a buftype({expr}) function, that can get the
> > > buffer type of any buffer, and make a difference between "quickfix" and
> > > "loclist".
> >
> > I see. Even though it's quite awkward to add a new function just to
> > accommodate this particular case, i'm attaching my attempt to
> > implement it.
>
> Yes, it is unexpected to have this function. But I can see it's useful.
> Would there be a better solution somehow?
> Perhaps using one of the existing quickfix functions?
Do you remember this thread?
We can't handle type which it's quickfix or location-list.
https://groups.google.com/d/msg/vim_dev/GIjn9QRyLag/M_8AJ5_UkMoJ
It also listed on the TODO.
TODO> Patch to check whether a buffer is quickfix or a location list.
TODO> (Yasuhiro Matsumoto, 2014 Dec 9)
I've arranged with several correct mistakes of this patch.
It will be `w:quickfix_type` is set. In the same way as the `w:quickfix_title`.
The values are 'quickfix' or 'location'.
What about an attached patch?
--
Best regards,
Hirohito Higashi (a.k.a. h_east)
2016-8-11(Thu) 5:32:16 UTC+9 Bram Moolenaar:
Okay. I understand.
Let's remove the following one from Todo list.
TODO> Patch to check whether a buffer is quickfix or a location list.
TODO> (Yasuhiro Matsumoto, 2014 Dec 9)
--