Monday, April 25, 2022

Re: %f item in getqflist()

On 2022-04-25, Lifepillar <lifepillar@lifepillar.me> wrote:
> I am looking into parsing a list of strings with an errorformat to
> create a quicklist or location list out of it. Currently, I am doing it
> as follows:
>
> let efm = "%f:%l:%m"
> let what = getqflist({"lines": ["foo:3:bar"], "efm": efm})
> call setloclist(0, what.items)
> echo what.items[0]
>
> This sets the quickfix list as expected (is there a better way?). But
> when I look at `what.items[0]`, I cannot find an item corresponding to
> %f (`foo` in the example). Yet setloclist() sets it. Where is that
> information stored?

Ah, I see: you get the filename from the buffer's number. A new buffer
is created for `foo` is one does not already exist. And when no filename
is parsed from the errorformat, bufnr is 0. Neat!

Life.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/t45qkt%24sb3%241%40ciao.gmane.io.

No comments: